ContactFollower.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class ContactFollower(object):
  6. def __init__(self):
  7. self._avatar = None
  8. self._default_avatar = None
  9. self._each_record_flag = None
  10. self._user_id = None
  11. @property
  12. def avatar(self):
  13. return self._avatar
  14. @avatar.setter
  15. def avatar(self, value):
  16. self._avatar = value
  17. @property
  18. def default_avatar(self):
  19. return self._default_avatar
  20. @default_avatar.setter
  21. def default_avatar(self, value):
  22. self._default_avatar = value
  23. @property
  24. def each_record_flag(self):
  25. return self._each_record_flag
  26. @each_record_flag.setter
  27. def each_record_flag(self, value):
  28. self._each_record_flag = value
  29. @property
  30. def user_id(self):
  31. return self._user_id
  32. @user_id.setter
  33. def user_id(self, value):
  34. self._user_id = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.avatar:
  38. if hasattr(self.avatar, 'to_alipay_dict'):
  39. params['avatar'] = self.avatar.to_alipay_dict()
  40. else:
  41. params['avatar'] = self.avatar
  42. if self.default_avatar:
  43. if hasattr(self.default_avatar, 'to_alipay_dict'):
  44. params['default_avatar'] = self.default_avatar.to_alipay_dict()
  45. else:
  46. params['default_avatar'] = self.default_avatar
  47. if self.each_record_flag:
  48. if hasattr(self.each_record_flag, 'to_alipay_dict'):
  49. params['each_record_flag'] = self.each_record_flag.to_alipay_dict()
  50. else:
  51. params['each_record_flag'] = self.each_record_flag
  52. if self.user_id:
  53. if hasattr(self.user_id, 'to_alipay_dict'):
  54. params['user_id'] = self.user_id.to_alipay_dict()
  55. else:
  56. params['user_id'] = self.user_id
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = ContactFollower()
  63. if 'avatar' in d:
  64. o.avatar = d['avatar']
  65. if 'default_avatar' in d:
  66. o.default_avatar = d['default_avatar']
  67. if 'each_record_flag' in d:
  68. o.each_record_flag = d['each_record_flag']
  69. if 'user_id' in d:
  70. o.user_id = d['user_id']
  71. return o