NIMRecentSession.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // NIMRecentSession.h
  3. // NIMLib
  4. //
  5. // Created by Netease.
  6. // Copyright (c) 2015 Netease. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @class NIMMessage;
  11. @class NIMSession;
  12. @class NIMRevokeMessageNotification;
  13. /**
  14. * 最后一条消息的类型。
  15. */
  16. typedef NS_ENUM(NSInteger, NIMLastMsgType){
  17. /*
  18. * 常规Message,NIMMessage类型,lastMessage字段
  19. */
  20. NIMLastMsgTypeNormalMessage,
  21. /*
  22. * 撤回通知,NIMRevokeMessageNotification类型,lastNotification字段
  23. */
  24. NIMLastMsgTypeRevokeNotication
  25. };
  26. /**
  27. * 最近会话
  28. */
  29. @interface NIMRecentSession : NSObject
  30. /**
  31. * 当前会话
  32. */
  33. @property (nullable,nonatomic,readonly,copy) NIMSession *session;
  34. /**
  35. * 最后一条消息
  36. */
  37. @property (nullable,nonatomic,strong) NIMMessage *lastMessage;
  38. /**
  39. * 未读消息数
  40. */
  41. @property (nonatomic,readonly,assign) NSInteger unreadCount;
  42. /**
  43. * 本地扩展
  44. */
  45. @property (nullable,nonatomic,readonly,copy) NSDictionary *localExt;
  46. /**
  47. * 服务端会话的最新更新时间,本地会话无效
  48. */
  49. @property (nonatomic,readonly,assign) NSTimeInterval updateTime;
  50. /**
  51. * 会话服务扩展字段(本地会话该字段无效)
  52. */
  53. @property (nonatomic,copy) NSString *serverExt;
  54. /**
  55. * 最后一条消息的类型(本地会话该字段无效)
  56. */
  57. @property (nonatomic, readonly, assign) NIMLastMsgType lastMessageType;
  58. /**
  59. * 最后一条撤回通知(本地会话该字段无效)
  60. * lastMessageType为NIMLastMsgTypeNormalMessage时,最后一条为普通消息,请使用lastMessage获取,本字段为nil
  61. * lastMessageType为NIMLastMsgTypeRevokeNotication时,lastMessage字段为nil,最后一条为撤回通知,请使用本字段获取
  62. */
  63. @property (nullable, nonatomic, readonly, strong) NIMRevokeMessageNotification *lastRevokeNotification;
  64. @end
  65. /**
  66. * 检索最近会话选项
  67. */
  68. @interface NIMRecentSessionOption : NSObject
  69. /**
  70. * 最后一条消息过滤
  71. * @discusssion 最近会话里lastMessage为非过滤类型里的最后一条。例:@[@(NIMMessageTypeNotification)],
  72. * 表示返回的最近会话里lastMessage是最后一条非NIMMessageTypeNotification类型的消息。
  73. */
  74. @property (nonatomic, strong) NSArray<NSNumber *> *filterLastMessageTypes;
  75. @end
  76. /**
  77. * 获取服务端会话列表可选参数
  78. */
  79. @interface NIMFetchServerSessionOption : NSObject
  80. /**
  81. * 最小时间戳,作为请求参数时表示增量获取Session列表,单位毫秒
  82. */
  83. @property (nonatomic, assign) NSTimeInterval minTimestamp;
  84. /**
  85. * 最大时间戳,翻页时使用, 单位毫秒,默认为当前时间
  86. */
  87. @property (nonatomic, assign) NSTimeInterval maxTimestamp;
  88. /**
  89. * 是否需要lastMsg,默认 YES
  90. */
  91. @property (nonatomic, assign) BOOL needLastMessage;
  92. /**
  93. * 结果集limit,最大100,默认100
  94. */
  95. @property (nonatomic, assign) NSInteger limit;
  96. @end
  97. NS_ASSUME_NONNULL_END