### Get Blacklist (Web/Electron/MiniProgram) Source: https://github.com/openimsdk/docs/blob/main/docs/sdks/api/relation/getBlackList.md Fetches the blacklist using the Web SDK. This example shows how to import and use the SDK, handling both success and error responses. ```javascript import { getSDK } from '@openim/wasm-client-sdk'; const IMSDK = getSDK(); // use in electron with ffi // import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render'; // const { instance: IMSDK } = getWithRenderProcess(); // use in mini program // import { getSDK } from '@openim/client-sdk'; // const IMSDK = getSDK(); IMSDK.getBlackList() .then(({ data }) => { // 调用成功 }) .catch(({ errCode, errMsg }) => { // 调用失败 }); ``` -------------------------------- ### Get User Info with OpenIM Uni-app Polyfill Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/user/getUsersInfo.md This example demonstrates fetching user information in a uni-app environment using the openim-uniapp-polyfill. It requires an operation ID for tracking and returns a Promise. ```javascript import IMSDK from 'openim-uniapp-polyfill'; const userIDList = ['userID1', 'userID2']; IMSDK.asyncApi('getUsersInfo', IMSDK.uuid(), userIDList) .then((data) => { // data: Queried user info list }) .catch(({ errCode, errMsg }) => { // Call failed }); ``` -------------------------------- ### Install OpenIM Client SDK Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/miniProgram.md Install the OpenIM Client SDK using npm or yarn. ```bash npm install @openim/client-sdk --save # or yarn add @openim/client-sdk ``` -------------------------------- ### Get Self User Info (React Native) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/user/getSelfUserInfo.md This example shows how to get the current user's information in a React Native application. Ensure the @openim/rn-client-sdk is installed and imported. ```javascript import OpenIMSDK from "@openim/rn-client-sdk"; OpenIMSDK.getSelfUserInfo() .then((data) => { // data: Personal info of current logged-in user }) .catch((error) => { // Call failed }); ``` -------------------------------- ### Get Users in Group (Uni-app) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/group/getUsersInGroup.md This example demonstrates fetching users in a group using the uni-app polyfill. It utilizes asyncApi and requires handling Promise callbacks for success and failure. ```javascript import IMSDK from 'openim-uniapp-polyfill'; IMSDK.asyncApi('getUsersInGroup', IMSDK.uuid(), { groupID: 'groupID', userIDList: ['userIDList'], }) .then(() => { // Success }) .catch(({ errCode, errMsg }) => { // Failure }); ``` -------------------------------- ### Get Friend List (JavaScript) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/relation/getFriendList.md Example of how to get the friend list using the JavaScript SDK. This example demonstrates success and failure handling with Promises. ```APIDOC ## GET /friendlist ### Description Retrieves the current user's friend list. Optionally filters out blocked contacts. ### Method GET ### Endpoint /friendlist ### Query Parameters - **filterBlack** (boolean) - Required - Whether to filter out the blocklist. - **operationID** (string) - Optional - Operation ID, used to pinpoint issues, keep unique, prefer time+random. ### Response #### Success Response (200) - **data** (FriendUserItem[]) - An array of friend information objects. #### Response Example ```json { "data": [ { "friendInfo": { ... }, "ownerUserID": "string", "addTime": 0, "remark": "string", "faceURL": "string", "nickname": "string", "Ex": "string" } ], "errCode": 0, "errMsg": "" } ``` ### Code Example (JavaScript) ```js import { getSDK } from '@openim/wasm-client-sdk'; const IMSDK = getSDK(); IMSDK.getFriendList({ filterBlack: false, operationID: 'some_unique_id' }) .then(({ data }) => { // Success: data contains the friend list console.log('Friend list:', data); }) .catch(({ errCode, errMsg }) => { // Failure console.error('Error fetching friend list:', errCode, errMsg); }); ``` ``` -------------------------------- ### Login and Event Subscription (Pure APP) Source: https://github.com/openimsdk/docs/blob/main/docs/sdks/quickstart/uniapp.md Example of logging in and subscribing to connection success events using the IMSDK in a pure APP project. Ensure the SDK is initialized before use. ```javascript import IMSDK from 'openim-uniapp-polyfill'; IMSDK.asyncApi('login', IMSDK.uuid(), { userID: '123', token: 'token', }); const onConnectSuccess = () => { // 连接成功 }; // 设置监听 IMSDK.subscribe(IMSDK.IMEvents.OnConnectSuccess, onConnectSuccess); // 卸载监听 IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectSuccess, onConnectSuccess); ``` -------------------------------- ### Get Users Info (Unity) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/user/getUsersInfo.md Example of how to get user information using the Unity SDK. ```APIDOC ## GET /users/info (Unity) ### Description Retrieves information for a list of users using the Unity SDK. ### Method GET ### Endpoint /users/info ### Parameters #### Path Parameters - **cb** (OnBase>) - Required - Callback. - **userIds** (string[]) - Required - User ID collection. - **groupId** (string) - Optional - Group ID. ### Request Example ```csharp IMSDK.GetUsersInfo((list,errCode,errMsg)=>{ if(list!= null){ }else{ } }, userIds, groupId); ``` ### Response #### Success Response (200) - **list** (List) - Queried user info list. #### Response Example ```json [ { "userID": "userID1", "nickname": "User One", "faceURL": "http://example.com/face1.jpg" }, { "userID": "userID2", "nickname": "User Two", "faceURL": "http://example.com/face2.jpg" } ] ``` ``` -------------------------------- ### Uni-app Initialization Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/initialization/initSDK.md Initialize the OpenIM SDK for Uni-app. This example demonstrates setting up the SDK with configuration and handling the initialization result using Promises. ```APIDOC ## POST /api/users ### Description Initializes the OpenIM SDK with the provided configuration. ### Method POST ### Endpoint /api/users ### Parameters #### Path Parameters - **param1** (type) - Required/Optional - Description #### Query Parameters - **param1** (type) - Required/Optional - Description #### Request Body - **config** (object) - Required - Initialization configuration object. - **apiAddr** (string) - Required - IM's API interface address. - **wsAddr** (string) - Required - IM's websocket address. - **platformID** (number) - Required - Platform identifier (1 for iOS, 2 for Android). - **dataDir** (string) - Required - Path for data storage. - **logLevel** (number) - Required - Log print level. - **logFilePath** (string) - Required - Directory where logs are stored. - **isLogStandardOutput** (boolean) - Required - Whether to output logs to the console. ### Request Example ```json { "config": { "apiAddr": "http://xxx:10002", "wsAddr": "ws://xxx:10001", "platformID": 1, "dataDir": "/path/to/data", "logLevel": 6, "logFilePath": "/path/to/logs", "isLogStandardOutput": true } } ``` ### Response #### Success Response (200) - **flag** (boolean) - Indicates if initialization was successful. #### Response Example ```json { "flag": true } ``` ### Return Result - **Promise.then()**: Promise - Indicates if initialization was successful. - **Promise.catch()**: Promise<[CatchResponse](/class/response.md)> - Handles failure callbacks. ``` -------------------------------- ### Get Users Info (React-Native) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/user/getUsersInfo.md Example of how to get user information using the React-Native SDK. ```APIDOC ## GET /users/info (React-Native) ### Description Retrieves information for a list of users using the React-Native SDK. ### Method GET ### Endpoint /users/info ### Parameters #### Query Parameters - **userIDList** (string[]) - Required - User userID list. - **operationID** (string) - Optional - Operation ID, used to pinpoint issues, keep unique, prefer time+random. ### Request Example ```javascript import OpenIMSDK from "@openim/rn-client-sdk"; const userIDList = ['userID1', 'userID2']; OpenIMSDK.getUsersInfo(userIDList) .then((data) => { // data: Queried user info list }) .catch((error) => { // Call failed }); ``` ### Response #### Success Response (200) - **data** (Array) - Queried user info list. #### Response Example ```json [ { "userID": "userID1", "nickname": "User One", "faceURL": "http://example.com/face1.jpg" }, { "userID": "userID2", "nickname": "User Two", "faceURL": "http://example.com/face2.jpg" } ] ``` ``` -------------------------------- ### Initialize OpenIM SDK Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/unity.md Initialize the SDK with configuration and a connection listener. Ensure this is done before other operations. ```csharp var suc = IMSDK.InitSDK(IMConfig config, IConnListener connCallBack); ``` -------------------------------- ### Get Users Info (JavaScript) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/user/getUsersInfo.md Example of how to get user information using the JavaScript SDK. ```APIDOC ## GET /users/info ### Description Retrieves information for a list of users. ### Method GET ### Endpoint /users/info ### Query Parameters - **userIDList** (string[]) - Required - A list of user IDs to retrieve information for. ### Request Example ```javascript import { getSDK } from '@openim/wasm-client-sdk'; const IMSDK = getSDK(); const userIDList = ['userID1', 'userID2']; IMSDK.getUsersInfo(userIDList) .then(({ data }) => { // data: Queried user info list }) .catch(({ errCode, errMsg }) => { // Call failed }); ``` ### Response #### Success Response (200) - **data** (Array) - A list of user information objects. #### Response Example ```json { "data": [ { "userID": "userID1", "nickname": "User One", "faceURL": "http://example.com/face1.jpg" }, { "userID": "userID2", "nickname": "User Two", "faceURL": "http://example.com/face2.jpg" } ] } ``` ``` -------------------------------- ### Unity Initialization Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/initialization/initSDK.md Initialize the OpenIM SDK for Unity. This example outlines the parameters required for SDK configuration and network connection status callbacks. ```APIDOC ## POST /openim-unity-sdk/InitSDK ### Description Initializes the OpenIM SDK for Unity applications. ### Method POST ### Endpoint /openim-unity-sdk/InitSDK ### Parameters #### Request Body - **config** (object) - Required - SDK configuration object. - **PlatformID** (number) - Required - SDK configuring. - **WsAddr** (string) - Required - IM's websocket address. - **ApiAddr** (string) - Required - IM's API interface address. - **DataDir** (string) - Required - Path for data storage. - **LogLevel** (number) - Required - Log print level. - **IsLogStandardOutput** (boolean) - Required - Whether to output logs to the console. - **LogFilePath** (string) - Required - Directory where logs are stored. - **IsExternalExtensions** (boolean) - Required - Whether to enable external extensions. - **cb** (object) - Required - Network connection status callback object implementing [IConnListener](/listener/connectListener.md). ### Request Example ```json { "config": { "PlatformID": 1, "WsAddr": "ws://your-server-ip:10001", "ApiAddr": "http://your-server-ip:10002", "DataDir": "/path/to/data", "LogLevel": 5, "IsLogStandardOutput": true, "LogFilePath": "/path/to/logs", "IsExternalExtensions": true }, "cb": {} } ``` ### Response #### Success Response (200) - **result** (boolean) - Indicates if initialization was successful. #### Response Example ```json { "result": true } ``` ``` -------------------------------- ### Uni-app SDK Example Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/conversation/getConversationIDBySessionType.md Example of using asyncApi to get conversation ID with the Uni-app SDK. ```APIDOC ## POST /api/conversation/id (asyncApi) ### Description Asynchronously retrieves a conversation ID using the `asyncApi` method. ### Method POST ### Endpoint /api/conversation/id ### Parameters #### Request Body - **operationID** (string) - Required - Operation ID, used to pinpoint issues, keep unique, prefer time+random. - **sourceID** (string) - Required - User ID for one-to-one chat, or group ID for group chat. - **sessionType** (SessionType) - Required - Session type. ### Request Example ```json { "operationID": "some_unique_id", "sourceID": "user1", "sessionType": 1 } ``` ### Response #### Success Response (200) - **data** (string) - The conversation ID. #### Response Example ```json "conv_12345" ``` ``` -------------------------------- ### Build OpenIM Server Services Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-guides/current/gettingStarted/cluster.md Run the bootstrap script to install Mage, then run Mage to build the OpenIM Server services. This is recommended before the first execution. ```bash bash bootstrap.sh ``` ```bash mage ``` -------------------------------- ### Clone OpenIM Electron Demo Project Source: https://github.com/openimsdk/docs/blob/main/docs/blog/client/build/Electron/electron-demo-build.md Use Git to clone the example project repository. Navigate into the project directory after cloning. ```bash git clone https://github.com/openimsdk/openim-electron-demo.git cd openim-electron-demo ``` -------------------------------- ### Get Friend List (Unity) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/relation/getFriendList.md Example for Unity using a callback-based approach to get the friend list. ```APIDOC ## POST /GetFriendList ### Description Retrieves the current user's friend list using a callback function. Allows filtering of blocked contacts. ### Method POST ### Endpoint /GetFriendList ### Parameters #### Input Parameters - **cb** (OnBase>) - Required - Callback function to handle the result. - **filterBlack** (bool) - Required - Whether to filter out the blocklist. ### Response #### Success Response The callback `cb` will be invoked with a list of `FriendInfo` objects upon success. #### Response Example (Callback) ```csharp // Inside the callback function: (List friendList, int errCode, string errMsg) => { if (errCode == 0) { // Success: Process the friendList Debug.Log("Friend list retrieved successfully."); } else { // Failure Debug.LogError($"Error fetching friend list: {errMsg}"); } } ``` ### Code Example (Unity) ```csharp // Assuming IMSDK is an instance of your OpenIM SDK wrapper IMSDK.GetFriendList((friendList, errCode, errMsg) => { if (errCode == 0) { // Success: Process the friendList Debug.Log("Friend list retrieved successfully."); foreach (var friend in friendList) { Debug.Log($"Friend: {friend.Nickname}"); } } else { // Failure Debug.LogError($"Error fetching friend list: {errMsg}"); } }, true); // true to filter out blocked contacts ``` ``` -------------------------------- ### Example S3 Migration Command Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-guides/current/solution/s3convert.md An example of how to run the S3 migration tool when configuration files are in the './../../config' directory and the old S3 name is 'minio'. ```shell ./s3convert -config ./../../config -name minio ``` -------------------------------- ### Get Friend List (uni-app) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/relation/getFriendList.md Example for uni-app using the `asyncApi` method to get the friend list. Requires the `openim-uniapp-polyfill` package. ```APIDOC ## POST /asyncApi (getFriendList) ### Description Retrieves the current user's friend list via the `asyncApi` method. Allows filtering of blocked contacts. ### Method POST ### Endpoint /asyncApi ### Parameters #### Request Body - **apiName** (string) - Required - The name of the API to call, which is 'getFriendList'. - **operationID** (string) - Required - Operation ID, used to pinpoint issues, keep unique, prefer time+random. - **params** (object) - Required - Parameters for the 'getFriendList' API. - **filterBlack** (boolean) - Required - Whether to filter out the blocklist. ### Response #### Success Response (200) - **data** (FriendUserItem[]) - A Promise resolving to a list of friend information objects. #### Response Example ```json { "data": [ { "friendInfo": { ... }, "ownerUserID": "string", "addTime": 0, "remark": "string", "faceURL": "string", "nickname": "string", "Ex": "string" } ], "errCode": 0, "errMsg": "" } ``` ### Code Example (uni-app) ```js import IMSDK from 'openim-uniapp-polyfill'; IMSDK.asyncApi('getFriendList', IMSDK.uuid(), { filterBlack: false }) .then((data) => { // Success console.log('Friend list:', data); }) .catch(({ errCode, errMsg }) => { // Failure console.error('Error fetching friend list:', errCode, errMsg); }); ``` ``` -------------------------------- ### Get One Conversation (Uni-app) Source: https://github.com/openimsdk/docs/blob/main/docs/sdks/api/conversation/getOneConversation.md This example shows how to get a conversation in a Uni-app environment using the `asyncApi` method. It requires the `openim-uniapp-polyfill` package. ```javascript import IMSDK from 'openim-uniapp-polyfill'; IMSDK.asyncApi('getOneConversation', IMSDK.uuid(), { sourceID: 'user1', sessionType: 1, }) .then((data) => { // 调用成功 }) .catch(({ errCode, errMsg }) => { // 调用失败 }); ``` -------------------------------- ### Web SDK Import and Initialization Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/group/createGroup.md Demonstrates how to import and initialize the OpenIM Web SDK. It shows different import methods for various environments like Electron and mini-programs. ```javascript import { getSDK } from '@openim/wasm-client-sdk'; const IMSDK = getSDK(); // use in electron with ffi // import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render'; // const { instance: IMSDK } = getWithRenderProcess(); // use in mini program // import { getSDK } from '@openim/client-sdk'; // const IMSDK = getSDK(); ``` -------------------------------- ### Get Users in Group (General) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/group/getUsersInGroup.md Example of how to call the getUsersInGroup function in the OpenIM SDK. ```APIDOC ## POST /api/users/getUsersInGroup ### Description Retrieves a list of user IDs that are members of a specified group. ### Method POST ### Endpoint /api/users/getUsersInGroup ### Parameters #### Request Body - **groupID** (string) - Required - The unique identifier for the group. - **userIDList** (string[]) - Required - A list of user IDs to check for membership within the group. ### Request Example ```json { "groupID": "your_group_id", "userIDList": ["user1_id", "user2_id"] } ``` ### Response #### Success Response (200) - **userList** (string[]) - A list of user IDs who are members of the specified group. #### Response Example ```json { "userList": ["user1_id", "user3_id"] } ``` ``` -------------------------------- ### Initialize SDK for Unity Source: https://github.com/openimsdk/docs/blob/main/docs/sdks/api/initialization/initSDK.md Initialize the SDK for Unity with IMConfig and a connection listener. The function returns a boolean indicating success. ```csharp var config = new IMConfig() { PlatformID = (int)PlatformID, WsAddr = wsAddr, ApiAddr = apiAddr, DataDir = dataDir, LogLevel = 5, IsLogStandardOutput = true, LogFilePath = logDir, IsExternalExtensions = true, }; var connListener = new IConnListener(); var res = IMSDK.InitSDK(config, connListener); ``` -------------------------------- ### Callback Configuration Example Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-restapi/current/webhooks/introduction.md This YAML snippet shows how to configure callback settings, including the URL, enable status, timeout, and failure handling. Ensure the URL is accessible by IMServer. ```yaml url: http://127.0.0.1:10006/callbackExample beforeSendSingleMsg: enable: false timeout: 5 failedContinue: true deniedTypes: [] beforeUpdateUserInfoEx: enable: false timeout: 5 failedContinue: true ``` -------------------------------- ### Get Conversation List Split (React-Native) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/conversation/getConversationListSplit.md Example of how to use the getConversationListSplit method in React-Native. ```APIDOC ## POST /api/conversation/get_conversation_list_split (React-Native) ### Description Fetches a paginated list of conversations in React-Native. ### Method POST ### Endpoint /api/conversation/get_conversation_list_split ### Parameters #### Request Body - **offset** (number) - Required - Start index for paginated fetch - **count** (number) - Required - Number of items per page #### Query Parameters - **operationID** (string) - Optional - Operation ID, used to pinpoint issues, keep unique, prefer time+random ### Request Example ```js import OpenIMSDK from "@openim/rn-client-sdk"; OpenIMSDK.getConversationListSplit({ offset: 0, count: 20, }, "your_operation_id") .then((data) => { // Call successful }) .catch((error) => { // Call failed }); ``` ### Response #### Success Response (200) - **ConversationItem[]** - An array of conversation items. #### Response Example ```json [ { "conversationID": "123", "conversationType": 1, "conversationName": "Test Conversation", "faceURL": "http://example.com/face.png", "lastMsg": {}, "messageCount": 100, "draftType": 0, "isPinned": false, "pinnedTime": 0, "isPrivateChat": false, "groupAtType": 0, "recvMsgOpt": 0, "unreadCount": 0, "isMsgDestruct": false, "destructTime": 0, "privateChatType": 0, "isCommGroup": false, "isFriendsType": 0, "isOwnGroup": false, "attachedInfo": "", "ex": "{}" } ] ``` ``` -------------------------------- ### Get Conversation List Split (JavaScript) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/conversation/getConversationListSplit.md Example of how to use the getConversationListSplit method in JavaScript. ```APIDOC ## POST /api/conversation/get_conversation_list_split ### Description Fetches a paginated list of conversations. ### Method POST ### Endpoint /api/conversation/get_conversation_list_split ### Parameters #### Request Body - **offset** (number) - Required - Start index for paginated fetch - **count** (number) - Required - Number of items per page - **operationID** (string) - Required - Operation ID, used to pinpoint issues, keep unique, prefer time+random ### Request Example ```json { "offset": 0, "count": 20, "operationID": "your_operation_id" } ``` ### Response #### Success Response (200) - **data** (ConversationItem[]) - An array of conversation items. #### Response Example ```json { "data": [ { "conversationID": "123", "conversationType": 1, "conversationName": "Test Conversation", "faceURL": "http://example.com/face.png", "lastMsg": {}, "messageCount": 100, "draftType": 0, "isPinned": false, "pinnedTime": 0, "isPrivateChat": false, "groupAtType": 0, "recvMsgOpt": 0, "unreadCount": 0, "isMsgDestruct": false, "destructTime": 0, "privateChatType": 0, "isCommGroup": false, "isFriendsType": 0, "isOwnGroup": false, "attachedInfo": "", "ex": "{}" } ] } ``` ``` -------------------------------- ### Configure OpenIM Channel Interactively Source: https://github.com/openimsdk/docs/blob/main/docs/guides/solution/openclaw.md Use the interactive setup command to configure the OpenIM Channel plugin. You will be prompted to enter necessary details like token, wsAddr, and apiAddr. ```bash openclaw openim setup ``` -------------------------------- ### Start Development Server and Electron App Source: https://github.com/openimsdk/docs/blob/main/docs/blog/client/build/Electron/electron-demo-build.md Run this command to launch the development server and the Electron application simultaneously. Access the local service address in your browser or use the automatically running desktop application for debugging. ```bash npm run dev ``` -------------------------------- ### uni-app SDK - Get Group Member List by Join Time Filter Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/group/getGroupMemberListByJoinTimeFilter.md Example of how to use the asyncApi function with the uni-app SDK to get group members filtered by join time. ```APIDOC ## POST /api/asyncApi ### Description Uses the `asyncApi` function to perform the `getGroupMemberListByJoinTimeFilter` operation in uni-app. ### Method POST ### Endpoint /api/asyncApi ### Parameters #### Request Body - **operationID** (string) - Required - Unique identifier for the operation. - **apiName** (string) - Required - The name of the API to call, which is `getGroupMemberListByJoinTimeFilter`. - **params** (object) - Required - Parameters for the `getGroupMemberListByJoinTimeFilter` operation: - **groupID** (string) - Required - The ID of the group. - **offset** (number) - Required - The starting offset for pagination. - **count** (number) - Required - The number of members to retrieve per page. - **joinTimeBegin** (number) - Required - The earliest join time (Unix timestamp). 0 means no limit. - **joinTimeEnd** (number) - Required - The latest join time (Unix timestamp). 0 means no limit. - **filterUserIDList** (string[]) - Required - A list of user IDs to exclude from the results. ### Request Example ```javascript import IMSDK from 'openim-uniapp-polyfill'; IMSDK.asyncApi('getGroupMemberListByJoinTimeFilter', IMSDK.uuid(), { groupID: 'your_group_id', offset: 0, count: 20, joinTimeBegin: 0, joinTimeEnd: 0, filterUserIDList: ['user1'], }) .then((data) => { console.log('Group members:', data); }) .catch(({ errCode, errMsg }) => { console.error('Error fetching group members:', errCode, errMsg); }); ``` ### Response #### Success Response (200) - **data** (GroupMemberItem[]) - An array of group member objects. #### Response Example ```json { "data": [ { "userID": "user123", "nickname": "John Doe", "faceURL": "http://example.com/face.jpg", "joinTime": 1678900000000, "role": 0 } ] } ``` ``` -------------------------------- ### Get Conversation List Split (Uni-app) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/conversation/getConversationListSplit.md Example of how to use the asyncApi method for getConversationListSplit in Uni-app. ```APIDOC ## POST /api/conversation/get_conversation_list_split (Uni-app) ### Description Fetches a paginated list of conversations using the asyncApi method in Uni-app. ### Method POST ### Endpoint /api/conversation/get_conversation_list_split ### Parameters #### Path Parameters - **operationID** (string) - Required - Operation ID, used to pinpoint issues, keep unique, prefer time+random #### Query Parameters - **offset** (number) - Required - Start index for paginated fetch - **count** (number) - Required - Number of items per page ### Request Example ```js import IMSDK from 'openim-uniapp-polyfill'; IMSDK.asyncApi('getConversationListSplit', IMSDK.uuid(), { offset: 0, count: 20, }) .then((data) => { // Call successful }) .catch(({ errCode, errMsg }) => { // Call failed }); ``` ### Response #### Success Response (200) - **ConversationItem[]** - An array of conversation items. #### Response Example ```json [ { "conversationID": "123", "conversationType": 1, "conversationName": "Test Conversation", "faceURL": "http://example.com/face.png", "lastMsg": {}, "messageCount": 100, "draftType": 0, "isPinned": false, "pinnedTime": 0, "isPrivateChat": false, "groupAtType": 0, "recvMsgOpt": 0, "unreadCount": 0, "isMsgDestruct": false, "destructTime": 0, "privateChatType": 0, "isCommGroup": false, "isFriendsType": 0, "isOwnGroup": false, "attachedInfo": "", "ex": "{}" } ] ``` ``` -------------------------------- ### Initialize SDK (Unity) Source: https://github.com/openimsdk/docs/blob/main/docs/sdks/api/initialization/initSDK.md Initializes the OpenIM SDK for Unity with configuration and a connection listener. Returns a boolean indicating success. ```APIDOC ## Initialize SDK (Unity) ### Description Initializes the OpenIM SDK for Unity with configuration and a connection listener. Returns a boolean indicating success. ### Method `public static bool InitSDK(IMConfig config, IConnCallBack cb)` ### Parameters #### Request Body - **config** (IMConfig) - Required - SDK configuration. - **cb** (IConnListener) - Required - Network connection status callback. ### Request Example ```C# var config = new IMConfig() { PlatformID = (int)PlatformID, WsAddr = wsAddr, ApiAddr = apiAddr, DataDir = dataDir, LogLevel = 5, IsLogStandardOutput = true, LogFilePath = logDir, IsExternalExtensions = true, }; var connListener = new IConnListener(); var res = IMSDK.InitSDK(config, connListener); ``` ``` -------------------------------- ### SDK Initialization Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/ios.md Steps to initialize the OpenIMSDK with configuration and callbacks for connection status. ```APIDOC ## SDK Initialization ### Description Initialize the OpenIMSDK by providing configuration details and setting up callbacks for connection events such as connecting, connection failure, successful connection, and being kicked offline. ### Method `initSDKWithConfig:onConnecting:onConnectFailure:onConnectSuccess:onKickedOffline:onUserTokenExpired:` ### Endpoint `OIMManager.manager` ### Parameters #### Request Body - **config** (OIMInitConfig) - Required - Configuration object for SDK initialization. - **apiAddr** (string) - Required - The API server address. - **wsAddr** (string) - Required - The WebSocket server address. - **objectStorage** (string) - Required - The object storage type. - **onConnecting** (OIMVoidCallback) - Optional - Callback when the SDK is attempting to connect. - **onConnectFailure** (OIMConnectFailureCallback) - Optional - Callback when the connection fails. - **code** (NSInteger) - Error code. - **msg** (NSString) - Error message. - **onConnectSuccess** (OIMVoidCallback) - Optional - Callback when the SDK successfully connects. - **onKickedOffline** (OIMVoidCallback) - Optional - Callback when the user is kicked offline. - **onUserTokenExpired** (OIMVoidCallback) - Optional - Callback when the user token expires. ### Request Example ```swift OIMInitConfig *config = [OIMInitConfig new]; config.apiAddr = @""; config.wsAddr = @""; config.objectStorage = @""; BOOL success = [OIMManager.manager initSDKWithConfig:config onConnecting:^{} onConnectFailure:^(NSInteger code, NSString * _Nullable msg) { // Connection failure callback // code: error code // error: error message } onConnectSuccess:^{} onKickedOffline:^{} onUserTokenExpired:^{}; ``` ### Response #### Success Response (200) - **success** (BOOL) - Indicates if the initialization was successful. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Unity SDK - Get Specified Groups Info Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/group/getSpecifiedGroupsInfo.md Example of how to use the GetSpecifiedGroupsInfo function with the Unity SDK. ```APIDOC ## POST /api/groups/info ### Description Retrieves information for a list of specified groups using the Unity SDK. ### Method POST ### Endpoint /api/groups/info ### Parameters #### Path Parameters - **cb** (OnBase>) - Required - Callback function to handle the result. - **groupIdList** (string[]) - Required - List of Group IDs. ### Request Example ```csharp IMSDK.GetSpecifiedGroupsInfo((list, errCode, errMsg) => { // Handle result }, new string[] {"groupID1", "groupID2"}); ``` ### Response #### Success Response (200) - **list** (List) - List of group information. - **errCode** (int) - Error code. - **errMsg** (string) - Error message. #### Response Example ```csharp // Example of callback handling: // IMSDK.GetSpecifiedGroupsInfo((list, errCode, errMsg) => { // if (errCode == 0) { // // Process the list of GroupInfo objects // } else { // // Handle error // } // }, new string[] {"groupID1", "groupID2"}); ``` ``` -------------------------------- ### React-Native SDK - Get Specified Groups Info Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/group/getSpecifiedGroupsInfo.md Example of how to use the getSpecifiedGroupsInfo function with the React-Native SDK. ```APIDOC ## POST /api/groups/info ### Description Retrieves information for a list of specified groups using the React-Native SDK. ### Method POST ### Endpoint /api/groups/info ### Parameters #### Query Parameters - **operationID** (string) - Optional - Operation ID, used to pinpoint issues, keep unique, prefer time+random. - **groupIDList** (string[]) - Required - List of Group IDs. ### Request Example ```javascript import OpenIMSDK from "@openim/rn-client-sdk"; const groupIDList = ['userID1', 'userID2']; OpenIMSDK.getSpecifiedGroupsInfo(groupIDList) .then((data) => { // Success }) .catch((error) => { // Failure }); ``` ### Response #### Success Response (200) - **data** (GroupInfo[]) - Group information list. #### Response Example ```json [ { "groupID": "group1", "groupName": "Test Group 1", "faceURL": "http://example.com/face1.png", "createTime": 1678886400, "groupType": 0, "status": 1, "ownerUserID": "user1", "adminUserIDList": ["user2", "user3"], "memberCount": 100, "ex": "{}" } ] ``` ``` -------------------------------- ### Build and Start Source Code Service Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-guides/current/gettingStarted/faq.md Builds the project using mage and then starts the service. This is for source code deployments. ```bash mage mage start ``` -------------------------------- ### JavaScript SDK - Get Specified Groups Info Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/group/getSpecifiedGroupsInfo.md Example of how to use the getSpecifiedGroupsInfo function with the JavaScript SDK. ```APIDOC ## GET /api/groups/info ### Description Retrieves information for a list of specified groups. ### Method GET ### Endpoint /api/groups/info ### Query Parameters - **groupIDList** (string[]) - Required - List of Group IDs to retrieve information for. ### Request Example ```javascript import { getSDK } from '@openim/wasm-client-sdk'; const IMSDK = getSDK(); const groupIDList = ['userID1', 'userID2']; IMSDK.getSpecifiedGroupsInfo(groupIDList) .then(({ data }) => { // Success }) .catch(({ errCode, errMsg }) => { // Failure }); ``` ### Response #### Success Response (200) - **data** (GroupInfo[]) - List of group information objects. #### Response Example ```json { "data": [ { "groupID": "group1", "groupName": "Test Group 1", "faceURL": "http://example.com/face1.png", "createTime": 1678886400, "groupType": 0, "status": 1, "ownerUserID": "user1", "adminUserIDList": ["user2", "user3"], "memberCount": 100, "ex": "{}" } ] } ``` ``` -------------------------------- ### Start Message Sending and Verification with Test Program A Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-guides/current/benchmark/benchmark_test.md Command to initiate message sending and verification after users are logged in. Use with Test Program A. ```bash go run main.go -lgr 1 -sem -ckmsn -u 20 -su 1 -lg 1 -cg 0 -lgm 110000 -msgitv 40 -gm 5000 -sm 0 ``` -------------------------------- ### Get Joined Group List (uni-app) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/group/getJoinedGroupListPage.md This example demonstrates how to get a list of joined groups within a uni-app project using the openim-uniapp-polyfill. It utilizes `asyncApi` and requires handling Promise callbacks for success and failure. ```javascript import IMSDK from 'openim-uniapp-polyfill'; IMSDK.asyncApi('getJoinedGroupList', IMSDK.uuid(), { offset: 0, count: 1000 }) .then((data) => { // Success }) .catch(({ errCode, errMsg }) => { // Failure }); ``` -------------------------------- ### Initialize and Login SDK (Electron) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/electron.md Initialize the OpenIM SDK with Electron-specific configurations and log in the user. Ensure to handle platformID correctly. ```typescript import { CbEvents, LogLevel } from '@openim/wasm-client-sdk'; import type { WSEvent } from '@openim/wasm-client-sdk/lib/types/entity'; IMSDK.on(CbEvents.OnConnecting, handleConnecting); IMSDK.on(CbEvents.OnConnectFailed, handleConnectFailed); IMSDK.on(CbEvents.OnConnectSuccess, handleConnectSuccess); // Electron await IMSDK.initSDK({ platformID: 'your-platform-id', apiAddr: 'http://your-server-ip:10002', wsAddr: 'ws://your-server-ip:10001', dataDir: 'your-db-dir', logFilePath: 'your-log-file-path', logLevel: LogLevel.Debug, isLogStandardOutput: true, }); await IMSDK.login({ userID: 'your-user-id', token: 'your-token', }); function handleConnecting() { // Connecting... } function handleConnectFailed({ errCode, errMsg }: WSEvent) { // Connection failed ❌ console.log(errCode, errMsg); } function handleConnectSuccess() { // Connection successful ✅ } ``` -------------------------------- ### Install WASM Client SDK Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/browser.md Install the OpenIM WASM Client SDK using npm or yarn. ```bash npm install @openim/wasm-client-sdk # or yarn add @openim/wasm-client-sdk ``` -------------------------------- ### Get Conversation ID (Unity) Source: https://github.com/openimsdk/docs/blob/main/docs/sdks/api/conversation/getConversationIDBySessionType.md This C# example shows how to get a conversation ID in Unity. It takes the source ID and session type as parameters and returns the conversation ID as a string upon successful retrieval. ```csharp var conversationID =IMSDK.GetConversationIDBySessionType(sourceID,sessionType); ``` -------------------------------- ### Get Friend List (React Native) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/relation/getFriendList.md Example for React Native using the `getFriendList` method directly from the SDK. ```APIDOC ## GET /friendlist ### Description Retrieves the current user's friend list. Optionally filters out blocked contacts. ### Method GET ### Endpoint /friendlist ### Parameters #### Query Parameters - **filterBlack** (boolean) - Required - Whether to filter out the blocklist. - **operationID** (string) - Optional - Operation ID, used to pinpoint issues, keep unique, prefer time+random. ### Response #### Success Response (200) - **data** (FriendUserItem[]) - An array of friend information objects. #### Response Example ```json { "data": [ { "friendInfo": { ... }, "ownerUserID": "string", "addTime": 0, "remark": "string", "faceURL": "string", "nickname": "string", "Ex": "string" } ], "errCode": 0, "errMsg": "" } ``` ### Code Example (React Native) ```js import OpenIMSDK from "@openim/rn-client-sdk"; OpenIMSDK.getFriendList(false, 'some_unique_id') .then((data) => { // Success console.log('Friend list:', data); }) .catch((error) => { // Failure console.error('Error fetching friend list:', error); }); ``` ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/openimsdk/docs/blob/main/docs/blog/client/build/Electron/electron-demo-build.md Install all necessary project dependencies using npm. This command should be run in the project's root directory. ```bash npm install ``` -------------------------------- ### Get Multiple Conversations (React-Native) Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/api/conversation/getMultipleConversation.md Provides an example for fetching multiple conversations in a React-Native environment using the OpenIMSDK. ```APIDOC ## POST /openIMSDK/getMultipleConversation ### Description Retrieves details for multiple conversations in a React-Native application. ### Method POST ### Endpoint /openIMSDK/getMultipleConversation ### Parameters #### Request Body - **conversationIDList** (string[]) - Required - A list of conversation IDs to retrieve. - **operationID** (string) - Optional - Unique identifier for the operation. ### Request Example ```javascript import OpenIMSDK from "@openim/rn-client-sdk"; OpenIMSDK.getMultipleConversation({ conversationIDList: ['conversationID'] }) .then((data) => { // Call successful }) .catch((error) => { // Call failed }); ``` ### Response #### Success Response (200) - **Promise.then()** (Promise>) - Callback for successful retrieval. #### Failure Response - **Promise.catch()** (Promise) - Callback for failed retrieval. ``` -------------------------------- ### Web SDK Call Example for onProgress Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/callback/onProgress.md Demonstrates how to use the onProgress callback in the Web SDK to receive message send progress updates. Ensure the SDK is correctly initialized. ```javascript import { getSDK } from '@openim/wasm-client-sdk'; const IMSDK = getSDK(); // use in electron with ffi // import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render'; // const { instance: IMSDK } = getWithRenderProcess(); // use in mini program // import { getSDK } from '@openim/client-sdk'; // const IMSDK = getSDK(); IMSDK.on(CbEvents.OnProgress, ({ data }) => { // data: message send progress }); ``` -------------------------------- ### Initialize OpenIMSDK Source: https://github.com/openimsdk/docs/blob/main/i18n/en/docusaurus-plugin-content-docs-sdks/current/quickstart/ios.md Initialize the SDK with your server addresses and object storage configuration. This method also sets up callbacks for connection status. ```swift OIMInitConfig *config = [OIMInitConfig new]; config.apiAddr = @""; config.wsAddr = @""; config.objectStorage = @""; BOOL success = [OIMManager.manager initSDKWithConfig:config onConnecting:^{} onConnectFailure:^(NSInteger code, NSString * _Nullable msg) { // Connection failure callback // code: error code // error: error message } onConnectSuccess:^{ // SDK successfully connected to the IM server } onKickedOffline:^{} onUserTokenExpired:^{}); ```