Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/survey_client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-12-17 14:11:51 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2015-12-17 14:11:51 +0300
commit7a7c66a80537391bafebcc650a10f348cdbe9bb0 (patch)
treea8bdf25b2c3e5090463aad0f37689c5b9b83e28d /appinfo
parent9f981671f37327aac03e21633fc7257765ebe4fa (diff)
Send request to the survey server
Diffstat (limited to 'appinfo')
-rw-r--r--appinfo/application.php60
-rw-r--r--appinfo/routes.php30
2 files changed, 90 insertions, 0 deletions
diff --git a/appinfo/application.php b/appinfo/application.php
new file mode 100644
index 0000000..01fa55b
--- /dev/null
+++ b/appinfo/application.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\PopularityContestClient\AppInfo;
+
+use OCA\PopularityContestClient\Controller\EndpointController;
+use OCA\PopularityContestClient\Collector;
+use OCP\AppFramework\App;
+use OCP\IContainer;
+
+class Application extends App {
+ public function __construct (array $urlParams = array()) {
+ parent::__construct('popularitycontestclient', $urlParams);
+ $container = $this->getContainer();
+
+ $container->registerService('EndpointController', function(IContainer $c) {
+ /** @var \OC\Server $server */
+ $server = $c->query('ServerContainer');
+
+ return new EndpointController(
+ $c->query('AppName'),
+ $server->getRequest(),
+ $c->query('OCA\PopularityContestClient\Collector'),
+ $server->getHTTPClientService()
+ );
+ });
+
+ $container->registerService('OCA\PopularityContestClient\Collector', function(IContainer $c) {
+ /** @var \OCP\IServerContainer $server */
+ $server = $c->query('ServerContainer');
+
+ return new Collector(
+ $server->getConfig(),
+ $server->getDatabaseConnection(),
+ $server->getIniWrapper(),
+ $server->getL10NFactory()->get('popularitycontestclient')
+ );
+ });
+
+ $container->registerCapability('Capabilities');
+ }
+}
diff --git a/appinfo/routes.php b/appinfo/routes.php
new file mode 100644
index 0000000..498e6d9
--- /dev/null
+++ b/appinfo/routes.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * @author Joas Schilling <nickvergessen@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+$application = new \OCA\PopularityContestClient\AppInfo\Application();
+
+\OCP\API::register(
+ 'post',
+ '/apps/popularitycontestclient/api/v1/report',
+ [$application->getContainer()->query('EndpointController'), 'sendReport'],
+ 'popularitycontestclient',
+ \OCP\API::ADMIN_AUTH
+);