NIMUser.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. //
  2. // NIMUser.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 NIMUserInfo;
  11. /**
  12. * 好友操作类型
  13. */
  14. typedef NS_ENUM(NSInteger, NIMUserOperation){
  15. /**
  16. * 添加好友
  17. * @discussion 直接添加为好友,无需验证
  18. */
  19. NIMUserOperationAdd = 1,
  20. /**
  21. * 请求添加好友
  22. */
  23. NIMUserOperationRequest = 2,
  24. /**
  25. * 通过添加好友请求
  26. */
  27. NIMUserOperationVerify = 3,
  28. /**
  29. * 拒绝添加好友请求
  30. */
  31. NIMUserOperationReject = 4,
  32. };
  33. /**
  34. * 用户性别
  35. */
  36. typedef NS_ENUM(NSInteger, NIMUserGender) {
  37. /**
  38. * 未知性别
  39. */
  40. NIMUserGenderUnknown,
  41. /**
  42. * 性别男
  43. */
  44. NIMUserGenderMale,
  45. /**
  46. * 性别女
  47. */
  48. NIMUserGenderFemale,
  49. };
  50. /**
  51. * 云信用户
  52. */
  53. @interface NIMUser : NSObject
  54. /**
  55. * 用户Id
  56. */
  57. @property (nullable,nonatomic,copy) NSString *userId;
  58. /**
  59. * 备注名,长度限制为128个字符。
  60. */
  61. @property (nullable,nonatomic,copy) NSString *alias;
  62. /**
  63. * 扩展字段
  64. */
  65. @property (nullable,nonatomic,copy) NSString *ext;
  66. /**
  67. * 服务器扩展字段
  68. * @discussion 该字段只能由服务器进行修改,客户端只能读取
  69. *
  70. */
  71. @property (nullable,nonatomic,copy,readonly) NSString *serverExt;
  72. /**
  73. * 用户资料,仅当用户选择托管信息到云信时有效
  74. * 用户资料除自己之外,不保证其他用户资料实时更新
  75. * 其他用户资料更新的时机为: 1.调用 - (void)fetchUserInfos:completion: 方法刷新用户
  76. * 2.收到此用户发来消息
  77. * 3.程序再次启动,此时会同步好友信息
  78. */
  79. @property (nullable,nonatomic,strong,readonly) NIMUserInfo *userInfo;
  80. /**
  81. * 是否需要消息提醒
  82. *
  83. * @return 是否需要消息提醒
  84. */
  85. - (BOOL)notifyForNewMsg;
  86. /**
  87. * 是否在黑名单中
  88. *
  89. * @return 是否在黑名单中
  90. */
  91. - (BOOL)isInMyBlackList;
  92. @end
  93. /**
  94. * 用户资料,仅当用户选择托管信息到云信时有效
  95. */
  96. @interface NIMUserInfo : NSObject
  97. /**
  98. * 用户昵称
  99. */
  100. @property (nullable,nonatomic,copy,readonly) NSString *nickName;
  101. /**
  102. * 用户头像
  103. */
  104. @property (nullable,nonatomic,copy,readonly) NSString *avatarUrl;
  105. /**
  106. * 用户头像缩略图
  107. * @discussion 仅适用于使用云信上传服务进行上传的资源,否则无效。
  108. */
  109. @property (nullable,nonatomic,copy,readonly) NSString *thumbAvatarUrl;
  110. /**
  111. * 用户签名
  112. */
  113. @property (nullable,nonatomic,copy,readonly) NSString *sign;
  114. /**
  115. * 用户性别
  116. */
  117. @property (nonatomic,assign,readonly) NIMUserGender gender;
  118. /**
  119. * 邮箱
  120. */
  121. @property (nullable,nonatomic,copy,readonly) NSString *email;
  122. /**
  123. * 生日
  124. */
  125. @property (nullable,nonatomic,copy,readonly) NSString *birth;
  126. /**
  127. * 电话号码
  128. */
  129. @property (nullable,nonatomic,copy,readonly) NSString *mobile;
  130. /**
  131. * 用户自定义扩展字段
  132. */
  133. @property (nullable,nonatomic,copy,readonly) NSString *ext;
  134. @end
  135. /**
  136. * 好友请求
  137. */
  138. @interface NIMUserRequest : NSObject
  139. /**
  140. * 目标用户ID
  141. */
  142. @property (nonatomic,copy) NSString *userId;
  143. /**
  144. * 操作类型
  145. */
  146. @property (nonatomic,assign) NIMUserOperation operation;
  147. /**
  148. * 附言
  149. */
  150. @property (nullable,nonatomic,copy) NSString *message;
  151. @end
  152. NS_ASSUME_NONNULL_END