AlipayOpenPublicMenuModifyModel.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.ButtonObject import ButtonObject
  6. class AlipayOpenPublicMenuModifyModel(object):
  7. def __init__(self):
  8. self._button = None
  9. self._type = None
  10. @property
  11. def button(self):
  12. return self._button
  13. @button.setter
  14. def button(self, value):
  15. if isinstance(value, list):
  16. self._button = list()
  17. for i in value:
  18. if isinstance(i, ButtonObject):
  19. self._button.append(i)
  20. else:
  21. self._button.append(ButtonObject.from_alipay_dict(i))
  22. @property
  23. def type(self):
  24. return self._type
  25. @type.setter
  26. def type(self, value):
  27. self._type = value
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.button:
  31. if isinstance(self.button, list):
  32. for i in range(0, len(self.button)):
  33. element = self.button[i]
  34. if hasattr(element, 'to_alipay_dict'):
  35. self.button[i] = element.to_alipay_dict()
  36. if hasattr(self.button, 'to_alipay_dict'):
  37. params['button'] = self.button.to_alipay_dict()
  38. else:
  39. params['button'] = self.button
  40. if self.type:
  41. if hasattr(self.type, 'to_alipay_dict'):
  42. params['type'] = self.type.to_alipay_dict()
  43. else:
  44. params['type'] = self.type
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = AlipayOpenPublicMenuModifyModel()
  51. if 'button' in d:
  52. o.button = d['button']
  53. if 'type' in d:
  54. o.type = d['type']
  55. return o