diff --git a/src/DiscourseAPI.php b/src/DiscourseAPI.php index 3de972b..e194a80 100644 --- a/src/DiscourseAPI.php +++ b/src/DiscourseAPI.php @@ -21,6 +21,7 @@ use CURLFile; use DateTime; use Exception; +use RuntimeException; use stdClass; use function is_int; @@ -1305,4 +1306,18 @@ public function getTopTopics( string $period = 'yearly', string $userName = 'sys return $res; } -} \ No newline at end of file + + /** + * @throws Exception + */ + public function getSite(): stdClass + { + $result = $this->_getRequest('/site.json'); + + if (!is_object($result) || !isset($result->apiresult)) { + throw new RuntimeException('Failed fetching site info'); + } + + return $result->apiresult; + } +}