Get.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Elasticsearch\Endpoints\Template;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. use Elasticsearch\Common\Exceptions;
  5. /**
  6. * Class Get
  7. *
  8. * @category Elasticsearch
  9. * @package Elasticsearch\Endpoints\Template
  10. * @author Zachary Tong <zach@elastic.co>
  11. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  12. * @link http://elastic.co
  13. */
  14. class Get extends AbstractEndpoint
  15. {
  16. /**
  17. * @throws \Elasticsearch\Common\Exceptions\RuntimeException
  18. * @return string
  19. */
  20. public function getURI()
  21. {
  22. if (isset($this->id) !== true) {
  23. throw new Exceptions\RuntimeException(
  24. 'id is required for Get'
  25. );
  26. }
  27. $templateId = $this->id;
  28. $uri = "/_search/template/$templateId";
  29. return $uri;
  30. }
  31. /**
  32. * @return string[]
  33. */
  34. public function getParamWhitelist()
  35. {
  36. return array();
  37. }
  38. /**
  39. * @return string
  40. */
  41. public function getMethod()
  42. {
  43. return 'GET';
  44. }
  45. }