-
Notifications
You must be signed in to change notification settings - Fork 964
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9376d4
commit 07ddc97
Showing
4 changed files
with
346 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
/** | ||
* User: zach | ||
* Date: 7/23/14 | ||
* Time: 2:25 PM | ||
*/ | ||
|
||
namespace Elasticsearch\Endpoints\Script; | ||
|
||
use Elasticsearch\Endpoints\AbstractEndpoint; | ||
use Elasticsearch\Common\Exceptions; | ||
|
||
/** | ||
* Class Delete | ||
* | ||
* @category Elasticsearch | ||
* @package Elasticsearch\Endpoints\Script | ||
* @author Zachary Tong <[email protected]> | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 | ||
* @link http://elasticsearch.org | ||
*/ | ||
|
||
class Delete extends AbstractEndpoint | ||
{ | ||
/** @var String */ | ||
private $lang; | ||
|
||
|
||
/** | ||
* @param $lang | ||
* | ||
* @return $this | ||
*/ | ||
public function setLang($lang) | ||
{ | ||
if (isset($lang) !== true) { | ||
return $this; | ||
} | ||
|
||
$this->lang = $lang; | ||
return $this; | ||
} | ||
|
||
|
||
/** | ||
* @throws \Elasticsearch\Common\Exceptions\RuntimeException | ||
* @return string | ||
*/ | ||
protected function getURI() | ||
{ | ||
if (isset($this->lang) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'lang is required for Put' | ||
); | ||
} | ||
if (isset($this->id) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'id is required for put' | ||
); | ||
} | ||
$id = $this->id; | ||
$lang = $this->lang; | ||
$uri = "/_scripts/$lang/$id"; | ||
|
||
return $uri; | ||
} | ||
|
||
|
||
/** | ||
* @return string[] | ||
*/ | ||
protected function getParamWhitelist() | ||
{ | ||
return array(); | ||
} | ||
|
||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getMethod() | ||
{ | ||
return 'DELETE'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
/** | ||
* User: zach | ||
* Date: 7/23/14 | ||
* Time: 2:25 PM | ||
*/ | ||
|
||
namespace Elasticsearch\Endpoints\Script; | ||
|
||
use Elasticsearch\Endpoints\AbstractEndpoint; | ||
use Elasticsearch\Common\Exceptions; | ||
|
||
/** | ||
* Class Get | ||
* | ||
* @category Elasticsearch | ||
* @package Elasticsearch\Endpoints\Script | ||
* @author Zachary Tong <[email protected]> | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 | ||
* @link http://elasticsearch.org | ||
*/ | ||
|
||
class Get extends AbstractEndpoint | ||
{ | ||
/** @var String */ | ||
private $lang; | ||
|
||
|
||
/** | ||
* @param $lang | ||
* | ||
* @return $this | ||
*/ | ||
public function setLang($lang) | ||
{ | ||
if (isset($lang) !== true) { | ||
return $this; | ||
} | ||
|
||
$this->lang = $lang; | ||
return $this; | ||
} | ||
|
||
|
||
/** | ||
* @throws \Elasticsearch\Common\Exceptions\RuntimeException | ||
* @return string | ||
*/ | ||
protected function getURI() | ||
{ | ||
if (isset($this->lang) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'lang is required for Put' | ||
); | ||
} | ||
if (isset($this->id) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'id is required for put' | ||
); | ||
} | ||
$id = $this->id; | ||
$lang = $this->lang; | ||
$uri = "/_scripts/$lang/$id"; | ||
|
||
return $uri; | ||
} | ||
|
||
|
||
/** | ||
* @return string[] | ||
*/ | ||
protected function getParamWhitelist() | ||
{ | ||
return array(); | ||
} | ||
|
||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getMethod() | ||
{ | ||
return 'GET'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
/** | ||
* User: zach | ||
* Date: 7/23/14 | ||
* Time: 2:25 PM | ||
*/ | ||
|
||
namespace Elasticsearch\Endpoints\Script; | ||
|
||
use Elasticsearch\Endpoints\AbstractEndpoint; | ||
use Elasticsearch\Common\Exceptions; | ||
|
||
/** | ||
* Class Put | ||
* | ||
* @category Elasticsearch | ||
* @package Elasticsearch\Endpoints\Script | ||
* @author Zachary Tong <[email protected]> | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 | ||
* @link http://elasticsearch.org | ||
*/ | ||
|
||
class Put extends AbstractEndpoint | ||
{ | ||
/** @var String */ | ||
private $lang; | ||
|
||
/** | ||
* @param $lang | ||
* | ||
* @return $this | ||
*/ | ||
public function setLang($lang) | ||
{ | ||
if (isset($lang) !== true) { | ||
return $this; | ||
} | ||
|
||
$this->lang = $lang; | ||
return $this; | ||
} | ||
|
||
|
||
/** | ||
* @param array $body | ||
* | ||
* @return $this | ||
*/ | ||
public function setBody($body) | ||
{ | ||
if (isset($body) !== true) { | ||
return $this; | ||
} | ||
|
||
$this->body = $body; | ||
return $this; | ||
} | ||
|
||
|
||
/** | ||
* @throws \Elasticsearch\Common\Exceptions\RuntimeException | ||
* @return string | ||
*/ | ||
protected function getURI() | ||
{ | ||
if (isset($this->lang) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'lang is required for Put' | ||
); | ||
} | ||
if (isset($this->id) !== true) { | ||
throw new Exceptions\RuntimeException( | ||
'id is required for put' | ||
); | ||
} | ||
$id = $this->id; | ||
$lang = $this->lang; | ||
$uri = "/_scripts/$lang/$id"; | ||
|
||
return $uri; | ||
} | ||
|
||
|
||
/** | ||
* @return string[] | ||
*/ | ||
protected function getParamWhitelist() | ||
{ | ||
return array(); | ||
} | ||
|
||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getMethod() | ||
{ | ||
return 'PUT'; | ||
} | ||
} |