OapiPlatformTranslateRequest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * dingtalk API: dingtalk.oapi.platform.translate request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2020.08.04
  7. */
  8. class OapiPlatformTranslateRequest
  9. {
  10. /**
  11. * 翻译源文字符串
  12. **/
  13. private $query;
  14. /**
  15. * 翻译源语言类型
  16. **/
  17. private $sourceLanguage;
  18. /**
  19. * 翻译目标语言类型
  20. **/
  21. private $targetLanguage;
  22. private $apiParas = array();
  23. public function setQuery($query)
  24. {
  25. $this->query = $query;
  26. $this->apiParas["query"] = $query;
  27. }
  28. public function getQuery()
  29. {
  30. return $this->query;
  31. }
  32. public function setSourceLanguage($sourceLanguage)
  33. {
  34. $this->sourceLanguage = $sourceLanguage;
  35. $this->apiParas["source_language"] = $sourceLanguage;
  36. }
  37. public function getSourceLanguage()
  38. {
  39. return $this->sourceLanguage;
  40. }
  41. public function setTargetLanguage($targetLanguage)
  42. {
  43. $this->targetLanguage = $targetLanguage;
  44. $this->apiParas["target_language"] = $targetLanguage;
  45. }
  46. public function getTargetLanguage()
  47. {
  48. return $this->targetLanguage;
  49. }
  50. public function getApiMethodName()
  51. {
  52. return "dingtalk.oapi.platform.translate";
  53. }
  54. public function getApiParas()
  55. {
  56. return $this->apiParas;
  57. }
  58. public function check()
  59. {
  60. RequestCheckUtil::checkNotNull($this->query,"query");
  61. RequestCheckUtil::checkNotNull($this->sourceLanguage,"sourceLanguage");
  62. RequestCheckUtil::checkNotNull($this->targetLanguage,"targetLanguage");
  63. }
  64. public function putOtherTextParam($key, $value) {
  65. $this->apiParas[$key] = $value;
  66. $this->$key = $value;
  67. }
  68. }