diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d4abed2..b042938d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Note: Nextcloud 27 is no longer supported since this version. - New OCS API endpoint to setAppInitProgress. The old one is marked as deprecated. #319 - Added default timeout for requestToExApp function set to 3s. #277 +- Added new PublicFunction method `getExApp`. #326 ### Changed diff --git a/lib/PublicFunctions.php b/lib/PublicFunctions.php index 5f158b4f..9b8cb758 100644 --- a/lib/PublicFunctions.php +++ b/lib/PublicFunctions.php @@ -101,4 +101,25 @@ public function asyncExAppRequestWithUserInit( } return $this->service->requestToExAppAsync($exApp, $route, $userId, $method, $params, $options, $request); } + + /** + * Get basic ExApp info by appid + * + * @param string $appId + * + * @return array ExApp info (appid, version, name, enabled) or null if no ExApp found + */ + public function getExApp(string $appId): ?array { + $exApp = $this->exAppService->getExApp($appId); + if ($exApp !== null) { + $info = $exApp->jsonSerialize(); + return [ + 'appid' => $info['appid'], + 'version' => $info['version'], + 'name' => $info['name'], + 'enabled' => $info['enabled'], + ]; + } + return null; + } }