NIMSession.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. NIMSessionTypeYSF = 3,
  30. /**
  31. * 超大群
  32. */
  33. NIMSessionTypeSuperTeam = 5,
  34. };
  35. /**
  36. * 会话对象
  37. */
  38. @interface NIMSession : NSObject<NSCopying>
  39. /**
  40. * 会话ID,如果当前session为team,则sessionId为teamId,如果是P2P则为对方帐号
  41. */
  42. @property (nonatomic,copy,readonly) NSString *sessionId;
  43. /**
  44. * 会话类型,当前仅支持P2P,Team和Chatroom
  45. */
  46. @property (nonatomic,assign,readonly) NIMSessionType sessionType;
  47. /**
  48. * 通过id和type构造会话对象
  49. *
  50. * @param sessionId 会话ID
  51. * @param sessionType 会话类型
  52. *
  53. * @return 会话对象实例
  54. */
  55. + (instancetype)session:(NSString *)sessionId
  56. type:(NIMSessionType)sessionType;
  57. + (nullable instancetype)sessionFromString:(NSString *)sessionString;
  58. @end
  59. NS_ASSUME_NONNULL_END