request = $request; } /** * @throws OCSBadRequestException */ #[AppAPIAuth] #[PublicPage] #[NoCSRFRequired] public function setAppConfigValue(string $configKey, mixed $configValue, ?int $sensitive = null): DataResponse { if ($configKey === '') { throw new OCSBadRequestException('Config key cannot be empty'); } $appId = $this->request->getHeader('EX-APP-ID'); $result = $this->exAppConfigService->setAppConfigValue($appId, $configKey, $configValue, $sensitive); if ($result instanceof ExAppConfig) { return new DataResponse($result, Http::STATUS_OK); } throw new OCSBadRequestException('Error setting app config value'); } #[AppAPIAuth] #[PublicPage] #[NoCSRFRequired] public function getAppConfigValues(array $configKeys): DataResponse { $appId = $this->request->getHeader('EX-APP-ID'); $result = $this->exAppConfigService->getAppConfigValues($appId, $configKeys); return new DataResponse($result, Http::STATUS_OK); } /** * @throws OCSBadRequestException * @throws OCSNotFoundException */ #[AppAPIAuth] #[PublicPage] #[NoCSRFRequired] public function deleteAppConfigValues(array $configKeys): DataResponse { $appId = $this->request->getHeader('EX-APP-ID'); $result = $this->exAppConfigService->deleteAppConfigValues($configKeys, $appId); if ($result === -1) { throw new OCSBadRequestException('Error deleting app config values'); } if ($result === 0) { throw new OCSNotFoundException('No appconfig_ex values deleted'); } return new DataResponse($result, Http::STATUS_OK); } }