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