AlipayDataDataserviceDatabusSendModel.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 AlipayDataDataserviceDatabusSendModel(object):
  6. def __init__(self):
  7. self._event_code = None
  8. self._event_payload = None
  9. self._payload_class = None
  10. self._topic = None
  11. @property
  12. def event_code(self):
  13. return self._event_code
  14. @event_code.setter
  15. def event_code(self, value):
  16. self._event_code = value
  17. @property
  18. def event_payload(self):
  19. return self._event_payload
  20. @event_payload.setter
  21. def event_payload(self, value):
  22. self._event_payload = value
  23. @property
  24. def payload_class(self):
  25. return self._payload_class
  26. @payload_class.setter
  27. def payload_class(self, value):
  28. self._payload_class = value
  29. @property
  30. def topic(self):
  31. return self._topic
  32. @topic.setter
  33. def topic(self, value):
  34. self._topic = value
  35. def to_alipay_dict(self):
  36. params = dict()
  37. if self.event_code:
  38. if hasattr(self.event_code, 'to_alipay_dict'):
  39. params['event_code'] = self.event_code.to_alipay_dict()
  40. else:
  41. params['event_code'] = self.event_code
  42. if self.event_payload:
  43. if hasattr(self.event_payload, 'to_alipay_dict'):
  44. params['event_payload'] = self.event_payload.to_alipay_dict()
  45. else:
  46. params['event_payload'] = self.event_payload
  47. if self.payload_class:
  48. if hasattr(self.payload_class, 'to_alipay_dict'):
  49. params['payload_class'] = self.payload_class.to_alipay_dict()
  50. else:
  51. params['payload_class'] = self.payload_class
  52. if self.topic:
  53. if hasattr(self.topic, 'to_alipay_dict'):
  54. params['topic'] = self.topic.to_alipay_dict()
  55. else:
  56. params['topic'] = self.topic
  57. return params
  58. @staticmethod
  59. def from_alipay_dict(d):
  60. if not d:
  61. return None
  62. o = AlipayDataDataserviceDatabusSendModel()
  63. if 'event_code' in d:
  64. o.event_code = d['event_code']
  65. if 'event_payload' in d:
  66. o.event_payload = d['event_payload']
  67. if 'payload_class' in d:
  68. o.payload_class = d['payload_class']
  69. if 'topic' in d:
  70. o.topic = d['topic']
  71. return o