createTextAtMessage
Feature Introduction
Note
Create @ messages.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<Message> createTextAtMessage({
required String text,
required List<String> atUserIDList,
List<AtUserInfo> atUserInfoList = const [],
Message? quoteMessage,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
text | String | Yes | Content |
atUserIDList | List<String> | Yes | List of @ user IDs |
atUserInfoList | List<AtUserInfo> | Yes | List of @ user info |
quoteMessage | Message | Yes | Quoted message |
Return Value
Name | Type | Description |
---|---|---|
~ | Message | Successful return |
Code Example
Message msg = await OpenIM.iMManager.messageManager.createTextAtMessage(text: text, atUserIDList: atUserIDList);
//todo
Function Prototype
+ (OIMMessageInfo *)createTextAtMessage:(NSString *)text
atUidList:(NSArray<NSString *> *)atUidList
atUsersInfo:(NSArray<OIMAtInfo *> *)atUsersInfo
message:(OIMMessageInfo * _Nullable)msg;
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
text | NSString | Yes | Content |
atUidList | NSArray<NSString *> | Yes | List of @ user IDs |
atUsersInfo | NSArray< OIMAtInfo * > | Yes | List of @ user info |
msg | OIMMessageInfo | Yes | Quoted message |
Return Value
Name | Type | Description |
---|---|---|
message | OIMMessageInfo | Successful return |
Code Example
OIMAtInfo *user1 = [OIMAtInfo new];
user1.atUserID = @"";
user1.groupNickname = @"";
OIMMessageInfo *message = [OIMMessageInfo createTextAtMessage:@"" atUidList:@[] atUsersInfo:@[user1] message:nil];
Function Prototype
+ (OIMMessageInfo *)createTextAtAllMessage:(NSString *)text
displayText:(NSString * _Nullable)displayText
message:(OIMMessageInfo * _Nullable)message;
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
text | NSString | Yes | Content |
displayText | NSString | No | Displayed text |
msg | OIMMessageInfo | No | Quoted message |
Return Value
Name | Type | Description |
---|---|---|
message | OIMMessageInfo | Successful return |
Code Example
OIMMessageInfo *message = [OIMMessageInfo createTextAtAllMessage:@""
displayText:nil
message:nil];
Function Prototype
public Message createTextAtMessage(String text, List<String> atUserIDList, List<AtUserInfo> atUserInfoList, Message quoteMessage)
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
text | String | Yes | Content |
atUserIDList | List<String> | Yes | List of @ user IDs |
atUserInfoList | List<AtUserInfo> | Yes | List of @ user info |
quoteMessage | Message | Yes | Quoted message |
Return Value
Name | Type | Description |
---|---|---|
~ | Message | Successful return |
Code Example
Message Message= OpenIMClient.getInstance().messageManager.createTextAtMessage( text, atUserIDList, atUserInfoList, quoteMessage)
Function Prototype
IMSDK.createTextAtMessage({
text: string;
atUserIDList: string[];
atUsersInfo: AtUsersInfoItem[];
message?: MessageItem;
}, operationID?: string): Promise<WsResponse<MessageItem>>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
text | string | Yes | Content |
atUserIDList | string[] | Yes | @user's userID list |
atUsersInfo | AtUsersInfoItem[] | Yes | @user info list |
message | MessageItem | Yes | Quoted message |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<MessageItem>> | Success callback |
Promise.catch() | Promise<WsResponse> | Failure callback |
Code Sample
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.createTextAtMessage({
text: "",
atUserIDList: ['userID'],
atUsersInfo: [
{
atUserID: "userID",
groupNickname: ""
},
],
message: {
// MessageItem
...
}
})
.then(({ data }) => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
IMSDK.asyncApi('createTextAtMessage', operationID: string, {
text: string;
atUserIDList: string[];
atUsersInfo: AtUsersInfoItem[];
message?: MessageItem;
}): Promise<MessageItem>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, for issue tracking, keep it unique, suggested to use current time and random number |
text | string | Yes | Content |
atUserIDList | string[] | Yes | @user's userID list |
atUsersInfo | AtUsersInfoItem[] | Yes | @user info list |
message | MessageItem | Yes | Quoted message |
Return Result
The function is made Promise-based using the
openim-uniapp-polyfill
package. You need to usethen
andcatch
to handle success and failure callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<MessageItem> | Success callback |
Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Sample
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('createTextAtMessage', IMSDK.uuid(), {
text: "",
atUserIDList: ['userID'],
atUsersInfo: [
{
atUserID: "userID",
groupNickname: ""
},
],
message: {
// MessageItem
...
}
})
.then((data) => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDKRN.createTextAtMessage({
text: string,
atUserIDList: string[],
atUsersInfo: AtUsersInfoItem[];
message?: MessageItem;
}, operationID: string): Promise<MessageItem>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
text | string | Yes | Content |
atUserIDList | string[] | Yes | @user's userID list |
atUsersInfo | AtUsersInfoItem[] | Yes | @user info list |
message | MessageItem | Yes | Quoted message |
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<MessageItem> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.createTextAtMessage({
text: "",
atUserIDList: ['userID'],
atUsersInfo: [
{
atUserID: "userID",
groupNickname: ""
},
],
message: {
// MessageItem
...
}
}, 'operationID')
.then((data) => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
public static Message CreateTextAtMessage(string text, string[] atUserList, AtInfo[] atUsersInfo, Message message)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
text | string | Yes | Content |
atUserIDList | string[] | Yes | @user's userID list |
atUserInfoList | AtInfo [] | Yes | @user info list |
quoteMessage | Message | Yes | Quoted message |
Return Result
Parameter Name | Type | Description |
---|---|---|
~ | Message | Message Struct |
Code Example
var msg = IMSDK.CreateTextAtMessage(text, satUserList, atUsersInfo, message);