# BMXConversation

**Inherits from** NSObject\
**Declared in** BMXConversation.h

## Properties

### conversationId

会话Id

`@property (nonatomic, assign, readonly) long long conversationId`

#### Discussion

会话Id

#### Declared In

* `BMXConversation.h`

### editMessage

编辑消息

`@property (nonatomic, copy) NSString *editMessage`

#### Discussion

编辑消息

#### Declared In

* `BMXConversation.h`

### extensionJson

扩展信息

`@property (nonatomic, copy) NSString *extensionJson`

#### Discussion

扩展信息

#### Declared In

* `BMXConversation.h`

### isMuteNotication

是否提醒用户消息,不提醒的情况下会话总未读数不会统计该会话计数。

`@property (nonatomic, assign) BOOL isMuteNotication`

#### Discussion

是否提醒用户消息,不提醒的情况下会话总未读数不会统计该会话计数。

#### Declared In

* `BMXConversation.h`

### lastMessage

最新消息

`@property (nonatomic, strong, readonly) BMXMessageObject *lastMessage`

#### Discussion

最新消息

#### Declared In

* `BMXConversation.h`

### messageCount

会话中所有消息数量

`@property (nonatomic, assign, readonly) NSInteger messageCount`

#### Discussion

会话中所有消息数量

#### Declared In

* `BMXConversation.h`

### type

会话类型

`@property (nonatomic, assign, readonly) BMXConversationType type`

#### Discussion

会话类型

#### Declared In

* `BMXConversation.h`

### unreadNumber

未读消息数量

`@property (nonatomic, assign, readonly) NSInteger unreadNumber`

#### Discussion

未读消息数量

#### Declared In

* `BMXConversation.h`

## Instance Methods

### insertMessage:completion:

插入一条消息

`- (void)insertMessage:(BMXMessageObject *)*msg* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*`

#### Parameters

_msg_\
message

_aCompletionBlock_\
Result

#### Discussion

插入一条消息

#### Declared In

* `BMXConversation.h`

### loadMessage:completion:

读取一条消息

`- (void)loadMessage:(long long)*msgId* completion:(void ( ^ ) ( BMXMessageObject *message ))*aCompletionBlock*`

#### Parameters

_msgId_\
msgId

_aCompletionBlock_\
Result

#### Discussion

读取一条消息

#### Declared In

* `BMXConversation.h`

### loadMessageFromMessageId:size:completion:

加载消息，从参考消息向前加载，如果不指定则从最新消息开始

`- (void)loadMessageFromMessageId:(long long)*reMsgId* size:(NSUInteger)*size* completion:(void ( ^ ) ( NSArray *messageList , BMXError *error ))*aCompletionBlock*`

#### Parameters

_reMsgId_\
参考消息Id

_size_\
size

_aCompletionBlock_\
Result：MessageList

#### Discussion

加载消息，从参考消息向前加载，如果不指定则从最新消息开始

#### Declared In

* `BMXConversation.h`

### removeAllMessagescompletion:

删除会话中的所有消息

`- (void)removeAllMessagescompletion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*`

#### Parameters

_aCompletionBlock_\
Result

#### Discussion

删除会话中的所有消息

#### Declared In

* `BMXConversation.h`

### searchMessagesByKeyWords:refTime:size:directionType:completion:

搜索消息，如果不指定则从最新消息开始

`- (void)searchMessagesByKeyWords:(NSString *)*keywords* refTime:(NSTimeInterval)*refTime* size:(NSUInteger)*size* directionType:(BMXMessageDirection)*directionType* completion:(void ( ^ ) ( NSArray<BMXMessageObject*> *messageList , BMXError *error ))*aCompletionBlock*`

#### Discussion

搜索消息，如果不指定则从最新消息开始

#### Declared In

* `BMXConversation.h`

### searchMessagesBycontentType:refTime:size:directionType:completion:

按照类型搜索消息，如果不指定则从最新消息开始

`- (void)searchMessagesBycontentType:(BMXContentType)*contentType* refTime:(NSTimeInterval)*refTime* size:(NSUInteger)*size* directionType:(BMXMessageDirection)*directionType* completion:(void ( ^ ) ( NSArray<BMXMessageObject*> *messageList , BMXError *error ))*aCompletionBlock*`

#### Discussion

按照类型搜索消息，如果不指定则从最新消息开始

#### Declared In

* `BMXConversation.h`

### setAllMessagesReadCompletion:

把所有消息设置为已读，更新未读消息数

`- (void)setAllMessagesReadCompletion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*`

#### Discussion

把所有消息设置为已读，更新未读消息数

#### Declared In

* `BMXConversation.h`

### setMessagePlayedStatus:status:completion:

设置消息播放状态（只对语音/视频消息有效）

`- (void)setMessagePlayedStatus:(BMXMessageObject *)*message* status:(bool)*status* completion:(void ( ^ ) ( BMXMessageObject *aMessage , BMXError *error ))*aCompletionBlock*`

#### Parameters

_message_\
message

_status_\
播放状态

_aCompletionBlock_\
Result

#### Discussion

设置消息播放状态（只对语音/视频消息有效）

#### Declared In

* `BMXConversation.h`

### setMessageReadStatus:status:completion:

设置消息未读状态，更新未读消息数, 本地

`- (void)setMessageReadStatus:(BMXMessageObject *)*message* status:(BOOL)*status* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*`

#### Parameters

_message_\
message

_status_\
是否已读

_aCompletionBlock_\
Result

#### Discussion

设置消息未读状态，更新未读消息数, 本地

#### Declared In

* `BMXConversation.h`

### updateMessageExtension:completion:

更新一条数据库存储消息的扩展字段信息

`- (void)updateMessageExtension:(BMXMessageObject *)*message* completion:(void ( ^ ) ( BMXError *error ))*aCompletionBlock*`

#### Parameters

_message_\
需要更改扩展信息的消息此时msg部分已经更新扩展字椴信息

_aCompletionBlock_\
更新结果

#### Discussion

更新一条数据库存储消息的扩展字段信息

#### Declared In

* `BMXConversation.h`
