OapiMediaUploadRequest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.media.upload request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2018.07.25
  7. */
  8. class OapiMediaUploadRequest
  9. {
  10. /**
  11. * form-data中媒体文件标识,有filename、filelength、content-type等信息
  12. **/
  13. private $media;
  14. /**
  15. * 媒体文件类型,分别有图片(image)、语音(voice)、普通文件(file)
  16. **/
  17. private $type;
  18. private $apiParas = array();
  19. public function setMedia($media)
  20. {
  21. $this->media = $media;
  22. $this->apiParas["media"] = $media;
  23. }
  24. public function getMedia()
  25. {
  26. return $this->media;
  27. }
  28. public function setType($type)
  29. {
  30. $this->type = $type;
  31. $this->apiParas["type"] = $type;
  32. }
  33. public function getType()
  34. {
  35. return $this->type;
  36. }
  37. public function getApiMethodName()
  38. {
  39. return "dingtalk.oapi.media.upload";
  40. }
  41. public function getApiParas()
  42. {
  43. return $this->apiParas;
  44. }
  45. public function check()
  46. {
  47. RequestCheckUtil::checkNotNull($this->media,"media");
  48. }
  49. public function putOtherTextParam($key, $value) {
  50. $this->apiParas[$key] = $value;
  51. $this->$key = $value;
  52. }
  53. }