OapiChatbotMessageSendRequest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.chatbot.message.send request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2019.08.20
  7. */
  8. class OapiChatbotMessageSendRequest
  9. {
  10. /**
  11. * 企业机器人模板类型
  12. **/
  13. private $chatbotId;
  14. /**
  15. * 消息内容,支持的消息类型详见:https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq#a-namesgw3aga%E6%B6%88%E6%81%AF%E7%B1%BB%E5%9E%8B%E5%8F%8A%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F
  16. **/
  17. private $message;
  18. /**
  19. * 企业员工ID
  20. **/
  21. private $userid;
  22. private $apiParas = array();
  23. public function setChatbotId($chatbotId)
  24. {
  25. $this->chatbotId = $chatbotId;
  26. $this->apiParas["chatbot_id"] = $chatbotId;
  27. }
  28. public function getChatbotId()
  29. {
  30. return $this->chatbotId;
  31. }
  32. public function setMessage($message)
  33. {
  34. $this->message = $message;
  35. $this->apiParas["message"] = $message;
  36. }
  37. public function getMessage()
  38. {
  39. return $this->message;
  40. }
  41. public function setUserid($userid)
  42. {
  43. $this->userid = $userid;
  44. $this->apiParas["userid"] = $userid;
  45. }
  46. public function getUserid()
  47. {
  48. return $this->userid;
  49. }
  50. public function getApiMethodName()
  51. {
  52. return "dingtalk.oapi.chatbot.message.send";
  53. }
  54. public function getApiParas()
  55. {
  56. return $this->apiParas;
  57. }
  58. public function check()
  59. {
  60. RequestCheckUtil::checkNotNull($this->chatbotId,"chatbotId");
  61. RequestCheckUtil::checkNotNull($this->message,"message");
  62. RequestCheckUtil::checkNotNull($this->userid,"userid");
  63. }
  64. public function putOtherTextParam($key, $value) {
  65. $this->apiParas[$key] = $value;
  66. $this->$key = $value;
  67. }
  68. }