createCardMessage
Feature Introduction
Description
Create a card message.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<Message> createCardMessage({
required String userID,
required String nickname,
String? faceURL,
String? ex,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
userID | String | Yes | User ID |
nickname | String | Yes | User Nickname |
faceURL | String | No | User Avatar |
ex | String | No | Extended Information |
Return Results
Name | Type | Description |
---|---|---|
~ | Message | Success Return |
Code Example
Message msg = await OpenIM.iMManager.messageManager.createCardMessage(
'userID':'userID',
);
//todo
Function Prototype
+ (OIMMessageInfo *)createCardMessage:(NSString *)content;
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
content | NSString | Yes | Text content |
Return Results
Name | Type | Description |
---|---|---|
message | OIMMessageInfo | Success Return |
Code Example
OIMMessageInfo *message = [OIMMessageInfo createCardMessage:@""];
Function Prototype
public Message createCardMessage(CardElem cardElem)
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
userID | String | Yes | User ID |
nickname | String | Yes | User Nickname |
faceURL | String | No | User Avatar |
ex | String | No | Extended Information |
Return Results
Name | Type | Description |
---|---|---|
~ | Message | Success Return |
Code Example
Message msg= OpenIMClient.getInstance().messageManager.createCardMessage(cardElem);
Function Prototype
IMSDK.createCardMessage({
userID: string;
nickname: string;
faceURL: string;
ex: string;
}, operationID?: string): Promise<WsResponse<MessageItem>>
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
userID | String | Yes | User ID |
nickname | String | Yes | User Nickname |
faceURL | String | No | User Avatar |
ex | String | No | Extended Information |
Return Results
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<MessageItem>> | Successful Callback |
Promise.catch() | Promise<WsResponse> | Failed Callback |
Code Example
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.createCardMessage({
userID: '',
nickname: '',
faceURL: '',
ex: '',
})
.then(({ data }) => {
// Successful Call
})
.catch(({ errCode, errMsg }) => {
// Failed Call
});
Function Prototype
IMSDK.asyncApi('createCardMessage', operationID: string, {
userID: string;
nickname: string;
faceURL: string;
ex: string;
}): Promise<MessageItem>
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
operationID | string | Yes | Operation ID for problem location, unique. Suggested to use current time and a random number. |
userID | String | Yes | User ID |
nickname | String | Yes | User Nickname |
faceURL | String | No | User Avatar |
ex | String | No | Extended Information |
Return Results
The
openim-uniapp-polyfill
package makes the function a Promise. You need to usethen
andcatch
to determine and handle successful and failed callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<MessageItem> | Successful Callback |
Promise.catch() | Promise<CatchResponse> | Failed Callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('createCardMessage', IMSDK.uuid(), {
userID: '',
nickname: '',
faceURL: '',
ex: '',
})
.then((data) => {
// Successful Call
})
.catch(({ errCode, errMsg }) => {
// Failed Call
});
### Function Prototype
OpenIMSDKRN.login({
userID:string,
nickname:string,
faceURL:string,
ex:string
}, operationID:string): Promise<MessageItem>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
userID | string | Yes | User ID |
nickname | string | Yes | User nickname |
faceURL | string | Yes | User avatar |
ex | string | Yes | Extended Information |
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.createCardMessage({
userID: '',
nickname: '',
faceURL: '',
ex: '',
}, 'operationID')
.then((data) => {
// Successful Call
})
.catch(({ errCode, errMsg }) => {
// Failed Call
});