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