- Android
- iOS
- JavaScript
- Flutter
- ReactNative
- HarmonyOS
Insert a conversation. The SDK inserts it both locally and in the cloud; cross-client synchronization is supported.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| conversation | Conversation | Conversation identifier | 1.0.0 |
| callback | ICreateConversationInfoCallback | Result callback | 1.0.0 |
Code Example
Conversation conversation = new Conversation(Conversation.ConversationType.PRIVATE, "userid1");
JIM.getInstance().getConversationManager().createConversationInfo(conversation, new IConversationManager.ICreateConversationInfoCallback() {
@Override
public void onSuccess(ConversationInfo conversationInfo) {
}
@Override
public void onError(int errorCode) {
}
});
Insert a conversation. The SDK inserts it both locally and in the cloud; cross-client synchronization is supported.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| conversation | JConversation | Conversation identifier | 1.0.0 |
| successBlock | Success callback | 1.0.0 | |
| errorBlock | Failure callback | 1.0.0 |
Code Example
JConversation *conversation = [[JConversation alloc] initWithConversationType:JConversationTypePrivate conversationId:@"userId1"];
[JIM.shared.conversationManager createConversationInfo:conversation success:^(JConversationInfo *) {
} error:^(JErrorCode code) {
}];
Insert a conversation. The SDK inserts it both locally and in the cloud; cross-client synchronization is supported. If the conversation already exists, the original conversation is overwritten.
On Web, conversation information depends on user information passed when obtaining a Token during registration, or on the avatar and group nickname specified when creating a group. If neither registration nor group creation includes this information, conversation information is unavailable.
Electron follows the Web behavior, but specified
conversationTitleandconversationPortraitvalues are stored in the local database and returned when retrieving the conversation list.
Parameters
| Name | Type | Required | Default | Description | Version |
|---|---|---|---|---|---|
| conversation | Object | Yes | None | Conversation object | 1.0.0 |
| conversation.conversationId | String | Yes | None | Conversation ID | 1.0.0 |
| conversation.conversationType | Number | Yes | None | Conversation type | 1.0.0 |
| conversation.conversationTitle | String | No | None | Conversation title | 1.0.0 |
| conversation.conversationPortrait | String | No | None | Conversation avatar | 1.0.0 |
Callback Parameters
| Property | Type | Description | Version |
|---|---|---|---|
| result | Object | Query result | 1.0.0 |
| result.conversation | Object | Conversation object, including user or group information | 1.0.0 |
Code Example
let { ConversationType } = JIM;
let conversation = {
conversationType: ConversationType.PRIVATE,
conversationId: 'userId01'
};
jim.insertConversation(conversation).then((result) => {
let { conversation } = result;
console.log(conversation);
});
Insert a conversation both locally and in the cloud. Synchronization to the current user's other devices is supported. If the conversation already exists, it is not overwritten. A successful insertion triggers the conversation listener event.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| conversation | Conversation | Conversation identifier | 0.6.3 |
Code Example
Conversation conversation = Conversation(ConversationType.private, 'userid1');
Result<ConversationInfo> result = await JuggleIm.instance.createConversationInfo(conversation);
Insert a conversation both locally and in the cloud. Synchronization to the current user's other devices is supported. If the conversation already exists, it is not overwritten. A successful insertion triggers the conversation listener event.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| conversation | Object | Conversation identifier | 0.6.3 |
| conversationType | Number | Conversation type | 0.6.3 |
| conversationId | String | Conversation ID | 0.6.3 |
Code Example
import JuggleIM from 'juggleim-rnsdk';
const result = await JuggleIM.createConversationInfo({
conversationType: 1,
conversationId: 'userid1'
});
Insert a conversation both locally and in the cloud. Synchronization to the current user's other devices is supported. If the conversation already exists, it is not overwritten.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| conversation | Conversation | Conversation identifier | 1.0.0 |
| callback | ConversationInsertCallback | Result callback | 1.0.0 |
API Definition
//Callback definition
export type ConversationInsertCallback = (code:number,conver:ConversationInfo)=>void
insertConversation(conver:Conversation,callback:ConversationInsertCallback)
Code Example
let conver = new Conversation("userid1",1)
JuggleIm.instance.getConversationManager().insertConversation(conver,(converInfo)=>{
})