123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- //
- // NIMMessageSearchOption.h
- // NIMLib
- //
- // Created by Netease.
- // Copyright (c) 2015 Netease. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- #import "NIMGlobalDefs.h"
- NS_ASSUME_NONNULL_BEGIN
- @class NIMMessage;
- /**
- * 搜索顺序
- */
- typedef NS_ENUM(NSInteger,NIMMessageSearchOrder) {
- /**
- * 从新消息往旧消息查询
- */
- NIMMessageSearchOrderDesc = 0,
-
- /**
- * 从旧消息往新消息查询
- */
- NIMMessageSearchOrderAsc = 1,
- };
- /**
- * 本地搜索选项
- * @discussion 搜索条件: 时间在(startTime,endTime) 内(不包含),类型为 messageTypes (或全类型) ,且匹配 searchContent 或 fromIds 的一定数量 (limit) 消息
- */
- @interface NIMMessageSearchOption : NSObject
- /**
- * 起始时间,默认为0
- */
- @property (nonatomic,assign) NSTimeInterval startTime;
- /**
- * 结束时间,默认为0
- * @discussion 搜索的结束时间,0 表示最大时间戳
- */
- @property (nonatomic,assign) NSTimeInterval endTime;
- /**
- * 检索条数
- * @discussion 默认100条,设置为0表示无条数限制
- */
- @property (nonatomic,assign) NSUInteger limit;
- /**
- * 检索顺序
- */
- @property (nonatomic,assign) NIMMessageSearchOrder order;
- /**
- * 查询的消息类型
- * @discusssion 消息类型组合,默认只搜索文本类型, 只有在 allMessageTypes 为 NO 时有效,取值范围为: NIMMessageType 枚举类型
- */
- @property (nonatomic,copy) NSArray<NSNumber *> *messageTypes;
- /**
- * 全部消息类型
- * @discussion 默认为 NO
- */
- @property (nonatomic,assign) BOOL allMessageTypes;
- /**
- * 检索文本
- */
- @property (nullable,nonatomic,copy) NSString *searchContent;
- /**
- * 消息发出者帐号列表
- */
- @property (nullable,nonatomic,copy) NSArray<NSString *> *fromIds;
- /**
- * 将搜索文本中的正则特殊字符转义,默认 YES
- */
- @property (nonatomic,assign) BOOL enableContentTransfer;
- @end
- /**
- * 检索服务器历史消息选项 (服务器)
- */
- @interface NIMHistoryMessageSearchOption : NSObject
- /**
- * 检索消息起始时间
- * @discussion 需要检索的起始时间,没有则传入0。
- */
- @property (nonatomic,assign) NSTimeInterval startTime;
- /**
- * 检索条数
- * @discussion 最大限制100条
- */
- @property (nonatomic,assign) NSUInteger limit;
- /**
- * 检索消息终止时间,此参数对聊天室会话无效。
- * @discussion 当前最早的时间,没有则传入 0。
- */
- @property (nonatomic,assign) NSTimeInterval endTime;
- /**
- * 检索消息的当前参考消息,返回的消息结果集里不会包含这条消息,此参数对聊天室会话无效。
- * @discussion 传入最早时间,没有则传入nil。
- */
- @property (nullable,nonatomic,strong) NIMMessage *currentMessage;
- /**
- * 检索顺序。
- */
- @property (nonatomic,assign) NIMMessageSearchOrder order;
- /**
- * 是否需要同步到 db,此参数对聊天室会话无效。
- * @discussion SDK 删除消息分为两种模式:标记删除和彻底删除(参见 NIMDeleteMessagesOption)。
- * 若消息集在本地被标记删除,则意味着消息仍存在本地,但被打上了特殊的记号,同步后写入 db 会失败。
- * 只有不存在本地的消息才可以通过 sync 标记进行 db 存储
- */
- @property (nonatomic,assign) BOOL sync;
- /**
- * 查询的消息类型
- * @discusssion 消息类型组合,默认为 nil ,搜索全类型。一旦设置了这个字段,则 sync 字段失效,查询结果不会写入 db,需要通过设置syncMessageTypes来同步 。
- */
- @property (nonatomic,copy) NSArray<NSNumber *> *messageTypes;
- /**
- * 是否需要同步特定类型到 db,此参数对聊天室会话无效。
- * @discussion SDK 删除消息分为两种模式:标记删除和彻底删除(参见 NIMDeleteMessagesOption)。
- * 若消息集在本地被标记删除,则意味着消息仍存在本地,但被打上了特殊的记号,同步后写入 db 会失败。
- * 只有不存在本地的消息才可以通过 syncMessageTypes 标记进行 db 存储
- */
- @property (nonatomic,assign) BOOL syncMessageTypes;
- @end
- /**
- * 服务端消息关键字检索选项
- * @discussion 搜索条件: 时间在(startTime,endTime) 内(不包含),类型为 messageTypes (或全类型) ,且匹配 searchContent 或 fromIds 的一定数量 (limit) 消息
- */
- @interface NIMMessageServerRetrieveOption : NSObject
- /**
- * 起始时间,默认为0
- */
- @property (nonatomic,assign) NSTimeInterval startTime;
- /**
- * 结束时间,默认为0
- * @discussion 搜索的结束时间,0 表示最大时间戳
- */
- @property (nonatomic,assign) NSTimeInterval endTime;
- /**
- * 检索条数
- * @discussion 默认100条,设置为0表示无条数限制,最多100条
- */
- @property (nonatomic,assign) NSUInteger limit;
- /**
- * 检索顺序
- */
- @property (nonatomic,assign) NIMMessageSearchOrder order;
- /**
- * 关键字
- */
- @property (nullable,nonatomic,copy) NSString *keyword;
- @end
- NS_ASSUME_NONNULL_END
|