SpiVoiceCallback.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class SpiVoiceCallback(object):
  6. def __init__(self):
  7. self._call_id = None
  8. self._callee = None
  9. self._duration = None
  10. self._end_time = None
  11. self._out_id = None
  12. self._start_time = None
  13. self._status_code = None
  14. @property
  15. def call_id(self):
  16. return self._call_id
  17. @call_id.setter
  18. def call_id(self, value):
  19. self._call_id = value
  20. @property
  21. def callee(self):
  22. return self._callee
  23. @callee.setter
  24. def callee(self, value):
  25. self._callee = value
  26. @property
  27. def duration(self):
  28. return self._duration
  29. @duration.setter
  30. def duration(self, value):
  31. self._duration = value
  32. @property
  33. def end_time(self):
  34. return self._end_time
  35. @end_time.setter
  36. def end_time(self, value):
  37. self._end_time = value
  38. @property
  39. def out_id(self):
  40. return self._out_id
  41. @out_id.setter
  42. def out_id(self, value):
  43. self._out_id = value
  44. @property
  45. def start_time(self):
  46. return self._start_time
  47. @start_time.setter
  48. def start_time(self, value):
  49. self._start_time = value
  50. @property
  51. def status_code(self):
  52. return self._status_code
  53. @status_code.setter
  54. def status_code(self, value):
  55. self._status_code = value
  56. def to_alipay_dict(self):
  57. params = dict()
  58. if self.call_id:
  59. if hasattr(self.call_id, 'to_alipay_dict'):
  60. params['call_id'] = self.call_id.to_alipay_dict()
  61. else:
  62. params['call_id'] = self.call_id
  63. if self.callee:
  64. if hasattr(self.callee, 'to_alipay_dict'):
  65. params['callee'] = self.callee.to_alipay_dict()
  66. else:
  67. params['callee'] = self.callee
  68. if self.duration:
  69. if hasattr(self.duration, 'to_alipay_dict'):
  70. params['duration'] = self.duration.to_alipay_dict()
  71. else:
  72. params['duration'] = self.duration
  73. if self.end_time:
  74. if hasattr(self.end_time, 'to_alipay_dict'):
  75. params['end_time'] = self.end_time.to_alipay_dict()
  76. else:
  77. params['end_time'] = self.end_time
  78. if self.out_id:
  79. if hasattr(self.out_id, 'to_alipay_dict'):
  80. params['out_id'] = self.out_id.to_alipay_dict()
  81. else:
  82. params['out_id'] = self.out_id
  83. if self.start_time:
  84. if hasattr(self.start_time, 'to_alipay_dict'):
  85. params['start_time'] = self.start_time.to_alipay_dict()
  86. else:
  87. params['start_time'] = self.start_time
  88. if self.status_code:
  89. if hasattr(self.status_code, 'to_alipay_dict'):
  90. params['status_code'] = self.status_code.to_alipay_dict()
  91. else:
  92. params['status_code'] = self.status_code
  93. return params
  94. @staticmethod
  95. def from_alipay_dict(d):
  96. if not d:
  97. return None
  98. o = SpiVoiceCallback()
  99. if 'call_id' in d:
  100. o.call_id = d['call_id']
  101. if 'callee' in d:
  102. o.callee = d['callee']
  103. if 'duration' in d:
  104. o.duration = d['duration']
  105. if 'end_time' in d:
  106. o.end_time = d['end_time']
  107. if 'out_id' in d:
  108. o.out_id = d['out_id']
  109. if 'start_time' in d:
  110. o.start_time = d['start_time']
  111. if 'status_code' in d:
  112. o.status_code = d['status_code']
  113. return o