InteligentPublishChannel.py 2.1 KB

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