OapiMessageCorpconversationSendbytemplateRequest.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.message.corpconversation.sendbytemplate request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2021.03.15
  7. */
  8. class OapiMessageCorpconversationSendbytemplateRequest
  9. {
  10. /**
  11. * 微应用的id
  12. **/
  13. private $agentId;
  14. /**
  15. * 消息模板动态参数赋值数据, key和value均为字符串格式。
  16. **/
  17. private $data;
  18. /**
  19. * 接收者的部门id列表
  20. **/
  21. private $deptIdList;
  22. /**
  23. * 消息模板id
  24. **/
  25. private $templateId;
  26. /**
  27. * 接收者的用户userid列表
  28. **/
  29. private $useridList;
  30. private $apiParas = array();
  31. public function setAgentId($agentId)
  32. {
  33. $this->agentId = $agentId;
  34. $this->apiParas["agent_id"] = $agentId;
  35. }
  36. public function getAgentId()
  37. {
  38. return $this->agentId;
  39. }
  40. public function setData($data)
  41. {
  42. $this->data = $data;
  43. $this->apiParas["data"] = $data;
  44. }
  45. public function getData()
  46. {
  47. return $this->data;
  48. }
  49. public function setDeptIdList($deptIdList)
  50. {
  51. $this->deptIdList = $deptIdList;
  52. $this->apiParas["dept_id_list"] = $deptIdList;
  53. }
  54. public function getDeptIdList()
  55. {
  56. return $this->deptIdList;
  57. }
  58. public function setTemplateId($templateId)
  59. {
  60. $this->templateId = $templateId;
  61. $this->apiParas["template_id"] = $templateId;
  62. }
  63. public function getTemplateId()
  64. {
  65. return $this->templateId;
  66. }
  67. public function setUseridList($useridList)
  68. {
  69. $this->useridList = $useridList;
  70. $this->apiParas["userid_list"] = $useridList;
  71. }
  72. public function getUseridList()
  73. {
  74. return $this->useridList;
  75. }
  76. public function getApiMethodName()
  77. {
  78. return "dingtalk.oapi.message.corpconversation.sendbytemplate";
  79. }
  80. public function getApiParas()
  81. {
  82. return $this->apiParas;
  83. }
  84. public function check()
  85. {
  86. RequestCheckUtil::checkNotNull($this->agentId,"agentId");
  87. RequestCheckUtil::checkMaxListSize($this->deptIdList,500,"deptIdList");
  88. RequestCheckUtil::checkNotNull($this->templateId,"templateId");
  89. RequestCheckUtil::checkMaxListSize($this->useridList,5000,"useridList");
  90. }
  91. public function putOtherTextParam($key, $value) {
  92. $this->apiParas[$key] = $value;
  93. $this->$key = $value;
  94. }
  95. }