TTSDKProfile.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // TTSDKProfile.h
  3. // TapTapSDK
  4. //
  5. // Created by TapTap on 2017/10/27.
  6. // Copyright © 2017年 易玩. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. /**
  10. * @brief TapTap用户信息封装类
  11. *
  12. * 该类封装了所有用户信息提供的返回数据
  13. */
  14. @interface TTSDKProfile : NSObject
  15. /// 用户名
  16. @property (nonatomic, readonly, strong) NSString *name;
  17. /// 用户头像
  18. @property (nonatomic, readonly, strong) NSString *avatar;
  19. /// open id
  20. @property (nonatomic, readonly, strong) NSString *openid;
  21. /// union id
  22. @property (nonatomic, readonly, strong) NSString *unionid;
  23. @property (nonatomic, readonly, strong) NSString *email;
  24. @property (nonatomic, readonly, assign, getter = isEmailVerified) BOOL emailVerified;
  25. - (instancetype)initWithJSON:(NSDictionary *)json;
  26. /**
  27. * @brief 获取当前用户信息
  28. *
  29. * 该用户信息会优先读取本地缓存,不存在时将会返回nil
  30. */
  31. + (TTSDKProfile *)currentProfile;
  32. + (void)fetchProfileForCurrentAccessToken:(void (^)(TTSDKProfile *profile, NSError *error))handler;
  33. - (NSString *)toJsonString;
  34. @end