AlipayOpenPublicMatchuserLabelDeleteModel.py 1.9 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.Matcher import Matcher
  6. class AlipayOpenPublicMatchuserLabelDeleteModel(object):
  7. def __init__(self):
  8. self._label_id = None
  9. self._matchers = None
  10. @property
  11. def label_id(self):
  12. return self._label_id
  13. @label_id.setter
  14. def label_id(self, value):
  15. self._label_id = value
  16. @property
  17. def matchers(self):
  18. return self._matchers
  19. @matchers.setter
  20. def matchers(self, value):
  21. if isinstance(value, list):
  22. self._matchers = list()
  23. for i in value:
  24. if isinstance(i, Matcher):
  25. self._matchers.append(i)
  26. else:
  27. self._matchers.append(Matcher.from_alipay_dict(i))
  28. def to_alipay_dict(self):
  29. params = dict()
  30. if self.label_id:
  31. if hasattr(self.label_id, 'to_alipay_dict'):
  32. params['label_id'] = self.label_id.to_alipay_dict()
  33. else:
  34. params['label_id'] = self.label_id
  35. if self.matchers:
  36. if isinstance(self.matchers, list):
  37. for i in range(0, len(self.matchers)):
  38. element = self.matchers[i]
  39. if hasattr(element, 'to_alipay_dict'):
  40. self.matchers[i] = element.to_alipay_dict()
  41. if hasattr(self.matchers, 'to_alipay_dict'):
  42. params['matchers'] = self.matchers.to_alipay_dict()
  43. else:
  44. params['matchers'] = self.matchers
  45. return params
  46. @staticmethod
  47. def from_alipay_dict(d):
  48. if not d:
  49. return None
  50. o = AlipayOpenPublicMatchuserLabelDeleteModel()
  51. if 'label_id' in d:
  52. o.label_id = d['label_id']
  53. if 'matchers' in d:
  54. o.matchers = d['matchers']
  55. return o