Add apiDoc comments for the sanity endpoint

This commit is contained in:
pxgamer
2018-10-12 11:55:24 +01:00
parent 3f42a53991
commit c8a8d3b9d0

15
api.php
View File

@@ -679,10 +679,21 @@ if ($q == "getAddress") {
api_echo($acc->account2alias($account));
} elseif ($q === 'sanity') {
/**
* @api {get} /api.php?q=sanity 20. sanity
* @apiName sanity
* @apiGroup API
* @apiDescription Returns details about the node's sanity process.
*
* @apiSuccess {object} data A collection of data about the sanity process.
* @apiSuccess {boolean} data.sanity_running Whether the sanity process is currently running.
* @apiSuccess {number} data.last_sanity The timestamp for the last time the sanity process was run.
* @apiSuccess {boolean} data.sanity_sync Whether the sanity process is currently synchronising.
*/
$sanity = file_exists(__DIR__.'/tmp/sanity-lock');
$lastSanity = $db->single("SELECT val FROM config WHERE cfg='sanity_last'");
$sanitySync = $db->single("SELECT val FROM config WHERE cfg='sanity_sync'");
$lastSanity = (int)$db->single("SELECT val FROM config WHERE cfg='sanity_last'");
$sanitySync = (bool)$db->single("SELECT val FROM config WHERE cfg='sanity_sync'");
api_echo(['sanity_running' => $sanity, 'last_sanity' => $lastSanity, 'sanity_sync' => $sanitySync]);
} elseif ($q=="node-info"){
$dbversion=$db->single("SELECT val FROM config WHERE cfg='dbversion'");