Add api procedure to get the application version
This commit is contained in:
parent
052b14d482
commit
23f8f2c576
|
|
@ -144,6 +144,32 @@ Array
|
|||
Procedures
|
||||
----------
|
||||
|
||||
### getVersion
|
||||
|
||||
- Purpose: **Get the application version**
|
||||
- Parameters: none
|
||||
- Result: **version** (Example: 1.0.12, master)
|
||||
|
||||
Request example:
|
||||
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "getVersion",
|
||||
"id": 1661138292
|
||||
}
|
||||
```
|
||||
|
||||
Response example:
|
||||
|
||||
```json
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1661138292,
|
||||
"result": "1.0.13"
|
||||
}
|
||||
```
|
||||
|
||||
### getTimezone
|
||||
|
||||
- Purpose: **Get the application timezone**
|
||||
|
|
|
|||
|
|
@ -418,6 +418,10 @@ $server->register('getTimezone', function() use ($container) {
|
|||
return $container['config']->get('application_timezone');
|
||||
});
|
||||
|
||||
$server->register('getVersion', function() use ($container) {
|
||||
return APP_VERSION;
|
||||
});
|
||||
|
||||
/**
|
||||
* Parse incoming requests
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Api extends PHPUnit_Framework_TestCase
|
|||
{
|
||||
$this->client = new JsonRPC\Client(API_URL);
|
||||
$this->client->authentication('jsonrpc', API_KEY);
|
||||
//$this->client->debug = true;
|
||||
// $this->client->debug = true;
|
||||
}
|
||||
|
||||
private function getTaskId()
|
||||
|
|
@ -53,8 +53,12 @@ class Api extends PHPUnit_Framework_TestCase
|
|||
|
||||
public function testGetTimezone()
|
||||
{
|
||||
$timezone = $this->client->getTimezone();
|
||||
$this->assertEquals('Europe/Paris', $timezone);
|
||||
$this->assertEquals('Europe/Paris', $this->client->getTimezone());
|
||||
}
|
||||
|
||||
public function testGetVersion()
|
||||
{
|
||||
$this->assertEquals('master', $this->client->getVersion());
|
||||
}
|
||||
|
||||
public function testRemoveAll()
|
||||
|
|
|
|||
Loading…
Reference in New Issue