2025-10-09 16:48:46 +08:00

127 lines
2.9 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// NIMRecentSession.h
// NIMLib
//
// Created by Netease.
// Copyright (c) 2015 Netease. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class NIMMessage;
@class NIMSession;
@class NIMRevokeMessageNotification;
/**
* 最后一条消息的类型。
*/
typedef NS_ENUM(NSInteger, NIMLastMsgType){
/*
* 常规MessageNIMMessage类型lastMessage字段
*/
NIMLastMsgTypeNormalMessage,
/*
* 撤回通知NIMRevokeMessageNotification类型lastNotification字段
*/
NIMLastMsgTypeRevokeNotication
};
/**
* 最近会话
*/
@interface NIMRecentSession : NSObject
/**
* 当前会话
*/
@property (nullable,nonatomic,readonly,copy) NIMSession *session;
/**
* 最后一条消息
*/
@property (nullable,nonatomic,strong) NIMMessage *lastMessage;
/**
* 未读消息数
*/
@property (nonatomic,readonly,assign) NSInteger unreadCount;
/**
* 本地扩展
*/
@property (nullable,nonatomic,readonly,copy) NSDictionary *localExt;
/**
* 服务端会话的最新更新时间,本地会话无效
*/
@property (nonatomic,readonly,assign) NSTimeInterval updateTime;
/**
* 会话服务扩展字段(本地会话该字段无效)
*/
@property (nonatomic,copy) NSString *serverExt;
/**
* 最后一条消息的类型(本地会话该字段无效)
*/
@property (nonatomic, readonly, assign) NIMLastMsgType lastMessageType;
/**
* 最后一条撤回通知(本地会话该字段无效)
* lastMessageType为NIMLastMsgTypeNormalMessage时最后一条为普通消息请使用lastMessage获取本字段为nil
* lastMessageType为NIMLastMsgTypeRevokeNotication时lastMessage字段为nil最后一条为撤回通知请使用本字段获取
*/
@property (nullable, nonatomic, readonly, strong) NIMRevokeMessageNotification *lastRevokeNotification;
@end
/**
* 检索最近会话选项
*/
@interface NIMRecentSessionOption : NSObject
/**
* 最后一条消息过滤
* @discusssion 最近会话里lastMessage为非过滤类型里的最后一条。例@[@(NIMMessageTypeNotification)],
* 表示返回的最近会话里lastMessage是最后一条非NIMMessageTypeNotification类型的消息。
*/
@property (nonatomic, strong) NSArray<NSNumber *> *filterLastMessageTypes;
@end
/**
* 获取服务端会话列表可选参数
*/
@interface NIMFetchServerSessionOption : NSObject
/**
* 最小时间戳作为请求参数时表示增量获取Session列表单位毫秒
*/
@property (nonatomic, assign) NSTimeInterval minTimestamp;
/**
* 最大时间戳,翻页时使用, 单位毫秒,默认为当前时间
*/
@property (nonatomic, assign) NSTimeInterval maxTimestamp;
/**
* 是否需要lastMsg默认 YES
*/
@property (nonatomic, assign) BOOL needLastMessage;
/**
* 结果集limit最大100默认100
*/
@property (nonatomic, assign) NSInteger limit;
@end
NS_ASSUME_NONNULL_END