NIMSession.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // NIMSession.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. /**
  11. * 会话类型
  12. */
  13. typedef NS_ENUM(NSInteger, NIMSessionType){
  14. /**
  15. * 点对点
  16. */
  17. NIMSessionTypeP2P = 0,
  18. /**
  19. * 群组
  20. */
  21. NIMSessionTypeTeam = 1,
  22. /**
  23. * 聊天室
  24. */
  25. NIMSessionTypeChatroom = 2,
  26. /**
  27. * 超大群
  28. */
  29. NIMSessionTypeSuperTeam = 5,
  30. };
  31. /**
  32. * 会话对象
  33. */
  34. @interface NIMSession : NSObject<NSCopying>
  35. /**
  36. * 会话ID,如果当前session为team,则sessionId为teamId,如果是P2P则为对方帐号
  37. */
  38. @property (nonatomic,copy,readonly) NSString *sessionId;
  39. /**
  40. * 会话类型,当前仅支持P2P,Team和Chatroom
  41. */
  42. @property (nonatomic,assign,readonly) NIMSessionType sessionType;
  43. /**
  44. * 通过id和type构造会话对象
  45. *
  46. * @param sessionId 会话ID
  47. * @param sessionType 会话类型
  48. *
  49. * @return 会话对象实例
  50. */
  51. + (instancetype)session:(NSString *)sessionId
  52. type:(NIMSessionType)sessionType;
  53. + (instancetype)sessionFromString:(NSString *)sessionString;
  54. @end
  55. NS_ASSUME_NONNULL_END