-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support of autocomplete endpoint
- Loading branch information
1 parent
0477b5c
commit bc22ea5
Showing
4 changed files
with
106 additions
and
1 deletion.
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
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,50 @@ | ||
<?php | ||
|
||
// Copyright (c) Manticore Software LTD (https://manticoresearch.com) | ||
// | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
namespace Manticoresearch\Endpoints; | ||
|
||
use Manticoresearch\Request; | ||
|
||
/** | ||
* Class Autocomplete | ||
* @package Manticoresearch\Endpoints | ||
*/ | ||
class Autocomplete extends Request | ||
{ | ||
/** | ||
* @return mixed|string | ||
*/ | ||
public function getPath() { | ||
return '/autocomplete'; | ||
} | ||
|
||
/** | ||
* @return mixed|string | ||
*/ | ||
public function getMethod() { | ||
return 'POST'; | ||
} | ||
|
||
/** | ||
* @return mixed|string | ||
*/ | ||
public function getContentType() { | ||
return 'application/json'; | ||
} | ||
|
||
/** | ||
* @param mixed $body | ||
*/ | ||
public function setBody($body = null) { | ||
if (is_array($body)) { | ||
$this->body = json_encode($body, true); | ||
} else { | ||
$this->body = $body; | ||
} | ||
} | ||
|
||
} |
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,22 @@ | ||
<?php | ||
|
||
// Copyright (c) Manticore Software LTD (https://manticoresearch.com) | ||
// | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
namespace Manticoresearch\Test\Endpoints; | ||
|
||
class AutocompleteTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
|
||
public function testGetPath() { | ||
$replace = new \Manticoresearch\Endpoints\Autocomplete(); | ||
$this->assertEquals('/autocomplete', $replace->getPath()); | ||
} | ||
|
||
public function testGetMethod() { | ||
$replace = new \Manticoresearch\Endpoints\Autocomplete(); | ||
$this->assertEquals('POST', $replace->getMethod()); | ||
} | ||
} |