Templates.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace Elasticsearch\Endpoints\Cat;
  3. use Elasticsearch\Endpoints\AbstractEndpoint;
  4. /**
  5. * Class Templates
  6. *
  7. * @category Elasticsearch
  8. * @package Elasticsearch\Endpoints\Cat
  9. * @author Zachary Tong <zach@elastic.co>
  10. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2
  11. * @link http://elastic.co
  12. */
  13. class Templates extends AbstractEndpoint
  14. {
  15. private $name;
  16. /**
  17. * @param string $name
  18. * @return Templates
  19. */
  20. public function setName($name)
  21. {
  22. $this->name = $name;
  23. return $this;
  24. }
  25. /**
  26. * @return string
  27. */
  28. public function getURI()
  29. {
  30. if (isset($this->name)) {
  31. return "/_cat/templates/{$this->name}";
  32. } else {
  33. return "/_cat/templates";
  34. }
  35. }
  36. /**
  37. * @return string[]
  38. */
  39. public function getParamWhitelist()
  40. {
  41. return array(
  42. 'format',
  43. 'node_id',
  44. 'actions',
  45. 'detailed',
  46. 'parent_node',
  47. 'parent_task',
  48. 'h',
  49. 'help',
  50. 'v',
  51. 's',
  52. 'local',
  53. 'master_timeout',
  54. );
  55. }
  56. /**
  57. * @return string
  58. */
  59. public function getMethod()
  60. {
  61. return 'GET';
  62. }
  63. }