YYWeiboModel.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //
  2. // WBModel.m
  3. // ModelBenchmark
  4. //
  5. // Created by ibireme on 15/9/18.
  6. // Copyright (c) 2015 ibireme. All rights reserved.
  7. //
  8. #import "YYWeiboModel.h"
  9. #define YYModelSynthCoderAndHash \
  10. - (void)encodeWithCoder:(NSCoder *)aCoder { [self yy_modelEncodeWithCoder:aCoder]; } \
  11. - (id)initWithCoder:(NSCoder *)aDecoder { return [self yy_modelInitWithCoder:aDecoder]; } \
  12. - (id)copyWithZone:(NSZone *)zone { return [self yy_modelCopy]; } \
  13. - (NSUInteger)hash { return [self yy_modelHash]; } \
  14. - (BOOL)isEqual:(id)object { return [self yy_modelIsEqual:object]; }
  15. @implementation YYWeiboPictureMetadata
  16. + (NSDictionary *)modelCustomPropertyMapper {
  17. return @{@"cutType" : @"cut_type"};
  18. }
  19. YYModelSynthCoderAndHash
  20. @end
  21. @implementation YYWeiboPicture
  22. + (NSDictionary *)modelCustomPropertyMapper {
  23. return @{@"picID" : @"pic_id",
  24. @"keepSize" : @"keep_size",
  25. @"photoTag" : @"photo_tag",
  26. @"objectID" : @"object_id",
  27. @"middlePlus" : @"middleplus"};
  28. }
  29. YYModelSynthCoderAndHash
  30. @end
  31. @implementation YYWeiboURL
  32. + (NSDictionary *)modelCustomPropertyMapper {
  33. return @{@"oriURL" : @"ori_url",
  34. @"urlTitle" : @"url_title",
  35. @"urlTypePic" : @"url_type_pic",
  36. @"urlType" : @"url_type",
  37. @"shortURL" : @"short_url",
  38. @"actionLog" : @"actionlog",
  39. @"pageID" : @"page_id",
  40. @"storageType" : @"storage_type"};
  41. }
  42. YYModelSynthCoderAndHash
  43. @end
  44. @implementation YYWeiboUser
  45. + (NSDictionary *)modelCustomPropertyMapper {
  46. return @{@"userID" : @"id",
  47. @"idString" : @"idstr",
  48. @"genderString" : @"gender",
  49. @"biFollowersCount" : @"bi_followers_count",
  50. @"profileImageURL" : @"profile_image_url",
  51. @"uclass" : @"class",
  52. @"verifiedContactEmail" : @"verified_contact_email",
  53. @"statusesCount" : @"statuses_count",
  54. @"geoEnabled" : @"geo_enabled",
  55. @"followMe" : @"follow_me",
  56. @"coverImagePhone" : @"cover_image_phone",
  57. @"desc" : @"description",
  58. @"followersCount" : @"followers_count",
  59. @"verifiedContactMobile" : @"verified_contact_mobile",
  60. @"avatarLarge" : @"avatar_large",
  61. @"verifiedTrade" : @"verified_trade",
  62. @"profileURL" : @"profile_url",
  63. @"coverImage" : @"cover_image",
  64. @"onlineStatus" : @"online_status",
  65. @"badgeTop" : @"badge_top",
  66. @"verifiedContactName" : @"verified_contact_name",
  67. @"screenName" : @"screen_name",
  68. @"verifiedSourceURL" : @"verified_source_url",
  69. @"pagefriendsCount" : @"pagefriends_count",
  70. @"verifiedReason" : @"verified_reason",
  71. @"friendsCount" : @"friends_count",
  72. @"blockApp" : @"block_app",
  73. @"hasAbilityTag" : @"has_ability_tag",
  74. @"avatarHD" : @"avatar_hd",
  75. @"creditScore" : @"credit_score",
  76. @"createdAt" : @"created_at",
  77. @"blockWord" : @"block_word",
  78. @"allowAllActMsg" : @"allow_all_act_msg",
  79. @"verifiedState" : @"verified_state",
  80. @"verifiedReasonModified" : @"verified_reason_modified",
  81. @"allowAllComment" : @"allow_all_comment",
  82. @"verifiedLevel" : @"verified_level",
  83. @"verifiedReasonURL" : @"verified_reason_url",
  84. @"favouritesCount" : @"favourites_count",
  85. @"verifiedType" : @"verified_type",
  86. @"verifiedSource" : @"verified_source",
  87. @"userAbility" : @"user_ability"};
  88. }
  89. YYModelSynthCoderAndHash
  90. @end
  91. @implementation YYWeiboStatus
  92. + (NSDictionary *)modelCustomPropertyMapper {
  93. return @{@"statusID" : @"id",
  94. @"createdAt" : @"created_at",
  95. @"attitudesStatus" : @"attitudes_status",
  96. @"inReplyToScreenName" : @"in_reply_to_screen_name",
  97. @"sourceType" : @"source_type",
  98. @"commentsCount" : @"comments_count",
  99. @"recomState" : @"recom_state",
  100. @"urlStruct" : @"url_struct",
  101. @"sourceAllowClick" : @"source_allowclick",
  102. @"bizFeature" : @"biz_feature",
  103. @"mblogTypeName" : @"mblogtypename",
  104. @"mblogType" : @"mblogtype",
  105. @"inReplyToStatusId" : @"in_reply_to_status_id",
  106. @"picIds" : @"pic_ids",
  107. @"repostsCount" : @"reposts_count",
  108. @"attitudesCount" : @"attitudes_count",
  109. @"darwinTags" : @"darwin_tags",
  110. @"userType" : @"userType",
  111. @"picInfos" : @"pic_infos",
  112. @"inReplyToUserId" : @"in_reply_to_user_id"};
  113. }
  114. + (NSDictionary *)modelContainerPropertyGenericClass {
  115. return @{@"picIds" : [NSString class],
  116. @"picInfos" : [YYWeiboPicture class],
  117. @"urlStruct" : [YYWeiboURL class]};
  118. }
  119. YYModelSynthCoderAndHash
  120. @end